forked from zdenekkostal/devstack
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathwebpack.build.config.js
More file actions
54 lines (47 loc) · 1.36 KB
/
Copy pathwebpack.build.config.js
File metadata and controls
54 lines (47 loc) · 1.36 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
44
45
46
47
48
49
50
51
52
53
54
var _ = require('lodash');
var path = require('path');
var webpack = require('webpack');
var getWebpackConfig = require('./webpack.config.js');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var uglifyOptions = {
mangle: true,
compress: {
sequences: true,
'dead_code': true,
'drop_debugger': true,
conditionals: true,
booleans: true,
unused: true,
'if_return': true,
'join_vars': true,
warnings: false
}
};
var buildConfig = _.assign(getWebpackConfig(), {
output: {
path: path.join(__dirname, '/build/'),
publicPath: '/',
filename: '[name].[hash].js'
}
});
buildConfig.plugins = buildConfig.plugins.concat(
new webpack.DefinePlugin({
'process.env': {
// This has effect on the react lib size
'NODE_ENV': JSON.stringify('production')
}
}),
new webpack.optimize.DedupePlugin(),
new webpack.optimize.UglifyJsPlugin(uglifyOptions),
new HtmlWebpackPlugin({
template: 'index.build.html'
}),
function() {
this.plugin('done', function(stats) {
var filename = path.join(__dirname, 'build', 'stats.json');
stats = JSON.stringify(stats.toJson(), null, '\t');
require('fs').writeFileSync(filename, stats);
});
}
);
module.exports = buildConfig;