-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.dist.js
More file actions
58 lines (50 loc) · 1.57 KB
/
Copy pathwebpack.dist.js
File metadata and controls
58 lines (50 loc) · 1.57 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
55
56
57
58
const webpack = require('webpack');
// plugins
const CommonsChunkPlugin = webpack.optimize.CommonsChunkPlugin;
// const DedupePlugin = webpack.optimize.DedupePlugin;
const DefinePlugin = webpack.DefinePlugin;
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const UglifyJsPlugin = webpack.optimize.UglifyJsPlugin;
const distConfig = require('./webpack.common.config');
distConfig.module.loaders = distConfig.module.loaders.concat(
{ test: /\.ts$/, exclude: [/\.spec\.ts$/], loaders: [ 'strip-debug', 'ts' ] }
);
distConfig.plugins = (distConfig.plugins || []).concat(
new DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production')
}),
// new ExtractTextPlugin('styles.css'),
// new DedupePlugin(),
new UglifyJsPlugin({
compress: {
dead_code: true,
screw_ie8: true,
unused: true,
warnings: false
},
mangle: false
}),
new HtmlWebpackPlugin({
chunksSortMode: 'none',
filename: 'index.html',
hash: true,
inject: 'body',
template: './src/index.html'
}),
new CommonsChunkPlugin({name: 'vendor', filename: 'vendor.js', minChunks: Infinity})
);
distConfig.output.publicPath = './';
distConfig.sassLoader.outputStyle = 'compressed';
distConfig.stats = {
cached: true,
cachedAssets: true,
chunks: true,
chunkModules: true,
colors: true,
hash: false,
reasons: false,
timings: true,
version: false
};
module.exports = distConfig;