forked from fireyy/react-antd-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.prod.config.js
36 lines (33 loc) · 985 Bytes
/
webpack.prod.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
var path = require('path');
var webpack = require('webpack');
var base = require('./webpack.config');
var LodashModuleReplacementPlugin = require('lodash-webpack-plugin');
base.devtool = 'source-map'
// use hash filename to support long-term caching
base.output.filename = '[name].[chunkhash:8].js'
base.output.chunkFilename = '[name].[chunkhash:8].js'
// add webpack plugins
base.plugins.push(
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production')
}),
new LodashModuleReplacementPlugin,
new webpack.optimize.UglifyJsPlugin({
sourceMap: true,
compress: {
warnings: false
},
output: {
comments: false
}
}),
// extract vendor chunks
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
filename: 'vendor.[chunkhash:8].js',
minChunks: function (module, count) {
return module.resource && module.resource.indexOf(path.resolve(__dirname, 'src')) === -1;
}
})
)
module.exports = base