UNPKG

1.83 kBJavaScriptView Raw
1var webpack = require('webpack')
2var merge = require('webpack-merge')
3var baseConfig = require('./webpack.base.conf')
4var cssLoaders = require('./css-loaders')
5var ExtractTextPlugin = require('extract-text-webpack-plugin')
6var HtmlWebpackPlugin = require('html-webpack-plugin')
7
8// whether to generate source map for production files.
9// disabling this can speed up the build.
10var SOURCE_MAP = true
11
12module.exports = merge(baseConfig, {
13 stats: {
14 children: false
15 },
16 devtool: SOURCE_MAP ? '#source-map' : false,
17 output: {
18 // naming output files with hashes for better caching.
19 // dist/index.html will be auto-generated with correct URLs.
20 filename: '[name].js',
21 chunkFilename: '[id].[chunkhash].js'
22 },
23 vue: {
24 loaders: cssLoaders({
25 sourceMap: SOURCE_MAP,
26 extract: true
27 })
28 },
29 plugins: [
30 // http://vuejs.github.io/vue-loader/workflow/production.html
31 new webpack.DefinePlugin({
32 'process.env': {
33 NODE_ENV: '"production"'
34 }
35 }),
36 new webpack.optimize.UglifyJsPlugin({
37 compress: {
38 warnings: false
39 }
40 }),
41 new webpack.optimize.OccurenceOrderPlugin(),
42 // extract css into its own file
43 new ExtractTextPlugin('[name].css'),
44 // generate dist index.html with correct asset hash for caching.
45 // you can customize output by editing /index.html
46 // see https://github.com/ampedandwired/html-webpack-plugin
47 new HtmlWebpackPlugin({
48 filename: '../index.html',
49 template: 'index.html',
50 inject: true,
51 minify: {
52 removeComments: true,
53 collapseWhitespace: true,
54 removeAttributeQuotes: true
55 // more options:
56 // https://github.com/kangax/html-minifier#options-quick-reference
57 }
58 })
59 ]
60})