-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.prod.js
35 lines (33 loc) · 1.06 KB
/
webpack.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
var path = require('path');
var webpack = require('webpack');
var baseWebpackConfig = require('./webpack.base.js');
var merge = require('webpack-merge');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var HtmlWebpackPlugin = require('html-webpack-plugin');
baseWebpackConfig.plugins = baseWebpackConfig.plugins.concat([
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production')
}
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
}),
new webpack.optimize.CommonsChunkPlugin('commons', 'lib/commons.[chunkhash].js'),
new ExtractTextPlugin('lib/[name].[contenthash].css', {allChunks: true}),
new HtmlWebpackPlugin({
title: 'cnode',
template: 'template/index.html',
inject: true,
filename: 'index.html',
chunks: ['commons', 'app']
})
]);
module.exports = merge(baseWebpackConfig, {
output: {
path: path.join(__dirname, 'dist'),
filename: 'lib/[name].[chunkhash].js'
}
})