-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdll.config.js
More file actions
43 lines (40 loc) · 1.02 KB
/
dll.config.js
File metadata and controls
43 lines (40 loc) · 1.02 KB
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 webpack = require('webpack')
const path = require('path')
const vendors = [
'react',
'react-dom'
]
module.exports = {
output: {
path: path.resolve(__dirname, 'static', 'libs'),
filename: 'dll.[name].js',
library: '[name]'
},
entry: {
'lib': vendors
},
plugins: [
new webpack.DllPlugin({
path: path.resolve(__dirname, 'dll.json'),
name: '[name]',
context: '.'
// context: __dirname
}),
new webpack.DefinePlugin({
'process.env': {
// This has effect on the react lib size
'NODE_ENV': JSON.stringify('production'),
},
}),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.UglifyJsPlugin({minimize: true})
],
resolve: {
// root: path.resolve(__dirname, "client"),
modulesDirectories: ['node_modules']
}
}
// 作者:Stark伟
// 链接:https://zhuanlan.zhihu.com/p/21748318
// 来源:知乎
// 著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。