-
Notifications
You must be signed in to change notification settings - Fork 31
/
webpack.config.prod.js
43 lines (41 loc) · 1.32 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
var path = require('path');
var webpack = require('webpack');
var baseWebpackConfig = require('./webpack.config.base.js');
var merge = require('webpack-merge');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var InlineManifestWebpackPlugin = require('inline-manifest-webpack-plugin');
baseWebpackConfig.plugins = baseWebpackConfig.plugins.concat([
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production')
}
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
},
output: {comments: false},
}),
new webpack.optimize.CommonsChunkPlugin({
names: ['vendor', 'manifest']
}),
new ExtractTextPlugin('lib/[name].[contenthash].css', {allChunks: true}),
new HtmlWebpackPlugin({
title: 'vue-cnode',
template: 'template/index.html',
inject: true,
filename: 'index.html',
chunks: ['vendor', 'app']
}),
new InlineManifestWebpackPlugin({
name: 'webpackManifest'
})
]);
module.exports = merge(baseWebpackConfig, {
output: {
path: path.join(__dirname, 'dist'),
filename: 'lib/[name].[chunkhash].js',
chunkFilename: 'lib/[id].build.[chunkhash].js'
}
})