-
Notifications
You must be signed in to change notification settings - Fork 8
/
webpack.config.prod.js
45 lines (44 loc) · 1.2 KB
/
webpack.config.prod.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
let webpack = require('webpack')
import baseConfig from './webpack.config.base'
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin')
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
module.exports = {
...baseConfig,
mode: 'production',
plugins: [
...baseConfig.plugins,
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
new webpack.DefinePlugin({
'process.env': {
'GH_PAGES': JSON.stringify(JSON.parse(process.env.GH_PAGES ||
'false'))
},
})
],
optimization: {
minimize: true,
minimizer: [
new UglifyJsPlugin({
cache: true,
parallel: true,
}),
new OptimizeCSSAssetsPlugin({})
],
splitChunks: {
cacheGroups: {
commons: {
test: /[\\/]node_modules[\\/]/,
name: 'vendor',
chunks: 'all'
}
}
}
},
module: {
...baseConfig.module,
rules: [
...baseConfig.module.rules
]
}
}