forked from liumin1128/ireader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.dll.config.js
45 lines (42 loc) · 959 Bytes
/
webpack.dll.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
44
45
const webpack = require('webpack');
const library = '[name]_lib';
const path = require('path');
module.exports = {
entry: {
vendors: [
'react',
'react-dom',
'react-redux',
'react-router',
'react-router-dom',
'redux',
'redux-saga',
],
},
output: {
filename: '[name].dll.js',
path: path.resolve(__dirname, 'dll'),
library,
},
plugins: [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production'),
},
}),
new webpack.DllPlugin({
path: path.join(__dirname, 'dll/[name]-manifest.json'),
context: __dirname,
name: library,
}),
// new webpack.optimize.ModuleConcatenationPlugin(), // 模块串联,大幅减少包大小257k =》239k
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false,
},
mangle: {
except: ['exports', 'require'],
},
}),
],
};