求解,为什么我在webpack用babel-loader@8.0.6打包有一堆不认识的依赖?
如下图,红色部分是我的代码,为了防止额外的依赖,我从网上下载的./crypto-js.min.js
引入,还是有很多没用的依赖,不知道是怎么打包进来的
这是依赖
package.json
这是我的webpack配置
const webpack = require('webpack');const path = require('path');
const { getIPAdress, findPara, assetsPath } = require('./utils/util');
const rules = require('./rules/dev');
// const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const webpackMerge = require('webpack-merge');
const pcConfig = require('./pc.config');
const h5Config = require('./h5.config');
const buildType = findPara('devtype');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const JavaScriptObfuscator = require('webpack-obfuscator');
var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
module.exports = {
entry: './src/index.ts',
output: {
path: path.resolve(__dirname, '../dist'),
filename: assetsPath('[name].[hash:8].js'),
libraryTarget: 'umd',
library: 'gp',
},
module: {
rules: [
{
test: /\.js$/,
use: ['loader" title="babel-loader">babel-loader'],
include: [
path.resolve('src'),
],
},
{
test: /\.tsx?$/,
use: [{
loader: JavaScriptObfuscator.loader,
options: {
rotateStringArray: true,
deadCodeInjection: true,
unicodeEscapeSequence: true,
}
},
'ts-loader'
],
include: [path.resolve('src')]
}
]
},
plugins: [
new webpack.HashedModuleIdsPlugin(),
// enable scope hoisting
new webpack.optimize.ModuleConcatenationPlugin(),
new CleanWebpackPlugin(),
new BundleAnalyzerPlugin(),
],
resolve: {
alias: {
'@': path.join(__dirname, '..'),
'@src': path.join(__dirname, '..', 'src')
}
},
}
回答
好像是因为这个
目前处理把这行代码删除,删前721kb,删后79kb..
以上是 求解,为什么我在webpack用babel-loader@8.0.6打包有一堆不认识的依赖? 的全部内容, 来源链接: utcz.com/a/39351.html