-
Notifications
You must be signed in to change notification settings - Fork 332
/
webpack.prod.config.js
45 lines (41 loc) · 1.56 KB
/
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
37
38
39
40
41
42
43
44
45
var path = require('path');
var webpack = require('webpack');
var common = require('./webpack.common.config.js');
var assign = require('object-assign');
var SaveAssetsJson = require('assets-webpack-plugin');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
module.exports = assign(common, {
stats: {reasons: false},
plugins: common.plugins.concat([
new webpack.optimize.AggressiveMergingPlugin(),
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production')
},
DEBUG: false,
'__DEV__': false
}),
new UglifyJsPlugin({
exclude: /conference.*?\.js$/,
sourceMap: true,
uglifyOptions: {warnings: true},
}),
// Save a webpack-assets.json file that maps base filename to filename with
// hash. This file is used by the webpack_asset mako filter to expand
// base filenames to full filename with hash.
new SaveAssetsJson(),
// Append hash to commons chunk for cachebusting
new webpack.optimize.CommonsChunkPlugin({ name: 'vendor', filename: 'vendor.[hash].js' }),
new webpack.LoaderOptionsPlugin({
debug: false,
minimize: true
})
]),
output: {
path: path.resolve(__dirname, 'website', 'static', 'public', 'js'),
// publicPath: '/static/', // used to generate urls to e.g. images
// Append hash to filenames for cachebusting
filename: '[name].[chunkhash].js',
sourcePrefix: ''
}
});