-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.prod.js
More file actions
44 lines (42 loc) · 1.24 KB
/
webpack.config.prod.js
File metadata and controls
44 lines (42 loc) · 1.24 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
var path = require('path');
var webpack = require('webpack');
var entry = require('./webpack.entry.js');
var htmlWebpackPlugin = require('html-webpack-plugin');
var cleanWebpackPlugin = require('clean-webpack-plugin');
module.exports = {
devtool: 'source-map',
entry: entry,
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'static/[id].[name].[chunkhash].bundle.js',
publicPath: '',
chunkFilename: '[id].[name].[chunkhash].bundle.js'
},
module: {
loaders: [
{ test: /\.js$/, exclude: /(node_modules|bower_components)/, loader: 'babel' },
{ test: /\.css$/, loaders: ['style', 'css'] },
{ test: /\.(png|jpg)$/, loader: 'url?limit=250000' }
]
},
plugins: [
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.NoErrorsPlugin(),
new webpack.optimize.UglifyJsPlugin({
compressor: {
warnings: false
}
}),
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('production')
}
}),
new htmlWebpackPlugin({
title: 'es2015 template',
filename: 'index.html',
template: path.join(__dirname, 'src/template/template.index.html')
}),
new cleanWebpackPlugin([path.join(__dirname, 'dist')]),
]
};