-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.prod.js
58 lines (56 loc) · 1.4 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
const webpack = require('webpack');
const path = require('path');
const OpenBrowserPlugin = require('open-browser-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const config = {
devtool: 'cheap-source-map',
entry: [
'webpack-dev-server/client?http://localhost:9090',
path.resolve(__dirname, 'app/index.js')
],
output: {
path: path.resolve(__dirname, 'build'),
filename: '[chunkhash:8].bundle.js',
publicPath: '/'
},
resolve: {
extensions: ['', '.js', '.jsx']
},
module: {
loaders: [{
test: /\.js|jsx$/,
exclude: /(node_modules|bower_components)/,
loaders: ['babel']
}, {
test: /(\.css|\.scss)$/,
loaders: ["style", "css", "sass"]
}, {
test: /\.(jpe?g|png|gif|svg)$/i,
loaders: [
'url?name=[hash:8].[name].[ext]',
'image-webpack?{progressive:true, optimizationLevel: 7, interlaced: false, pngquant:{quality: "65-90", speed: 4}}'
]
}]
},
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production'),
__DEV__: JSON.stringify(JSON.parse(process.env.DEBUG || 'false'))
}),
new webpack.optimize.DedupePlugin(),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
}),
new HtmlWebpackPlugin({
template: 'app/index.tpl.html',
filename: 'index.html',
inject: true
}),
new OpenBrowserPlugin({
url: 'http://localhost:9090/'
})
]
};
module.exports = config;