-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.prod.js
47 lines (42 loc) · 1.31 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
46
47
const path = require('path');
const webpack = require('webpack');
const merge = require('webpack-merge');
const WebpackAutoInjectVersion = require('webpack-auto-inject-version');
const apps = require('./apps.json');
const baseConfig = require('./webpack.config.base');
const ownConfig = {
output: {
path: path.join(__dirname, 'dist-prod'),
filename: '[name].bundle.js',
},
devtool: 'nosources-source-map',
plugins: [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production'),
LOG_LEVEL: JSON.stringify('+error,-warn,-info,-log,+perf'),
},
}),
new webpack.LoaderOptionsPlugin({
minimize: true,
debug: false,
}),
new webpack.optimize.UglifyJsPlugin({
beautify: false,
mangle: {
screw_ie8: true,
keep_fnames: true,
},
compress: {
screw_ie8: true,
},
warnings: false,
}),
new WebpackAutoInjectVersion(),
],
};
ownConfig.entry = apps.reduce((entries, app) => {
entries[app.chunk] = ['babel-polyfill', `./src/${app.chunk}/${app.chunk}.index.js`];
return entries;
}, {});
module.exports = merge(baseConfig, ownConfig);