-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
43 lines (42 loc) · 1.18 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin
if (process.env.NODE_ENV === 'production') {
module.exports = {
// plugins: [new BundleAnalyzerPlugin()],
target: ['web', 'es5'],
optimization: {
// 代码压缩
minimize: true
},
module: {
rules: [
{
// 万物皆模块 在解析js模块时先交给 use中的loader处理
test: /\.js$/,
// 不会处理我们的第三方库代码
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: require('./babel.config')
}
},
{
test: /\.dataurl$/,
use: 'raw-loader'
}
]
},
}
} else {
module.exports = {
module: {
rules: [
{
test: /\.dataurl$/,
use: {
loader:'raw-loader'
}
}
]
}
}
}