-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.config.prod.js
86 lines (77 loc) · 1.87 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var path = require('path');
var webpack = require('webpack');
module.exports = {
cache: true,
debug: true,
devtool: 'source-map',
entry: {
main: './src/main.js',
vendor: [
'angular',
'angular-aria',
'angular-ui-router',
'@reactivex/rxjs/dist/cjs/Rx'
]
},
output: {
filename: '[name].js',
path: path.resolve('./target'),
publicPath: '/'
},
resolve: {
extensions: ['', '.js'],
modulesDirectories: ['node_modules'],
root: path.resolve('./src')
},
module: {
loaders: [
{test: /\.js$/, exclude: /node_modules/, loader: 'babel'},
{test: /\.html$/, loader: 'raw'},
{test: /\.scss/, loader: ExtractTextPlugin.extract(
'css!autoprefixer-loader?{browsers:["last 3 versions", "Firefox ESR"]}!sass'
)}
]
},
sassLoader: {
outputStyle: 'compressed',
precision: 10,
sourceComments: false
},
plugins: [
new ExtractTextPlugin('styles.css'),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production')
}),
new webpack.optimize.DedupePlugin(),
new webpack.optimize.AggressiveMergingPlugin(),
new webpack.optimize.CommonsChunkPlugin('vendor', '[name].js'),
new webpack.optimize.UglifyJsPlugin({
compress: {
dead_code: true,
screw_ie8: true,
unused: true,
warnings: false
}
}),
new HtmlWebpackPlugin({
filename: 'index.html',
inject: 'body',
hash: true,
template: 'src/index.html'
})
],
stats: {
cached: true,
cachedAssets: true,
chunks: true,
chunkModules: false,
colors: true,
hash: false,
reasons: true,
timings: true,
version: false
}
};