60
|
1 var webpack = require('webpack');
|
|
2 var webpackMerge = require('webpack-merge');
|
|
3 var ExtractTextPlugin = require('extract-text-webpack-plugin');
|
|
4 var commonConfig = require('./webpack.common.js');
|
|
5 var helpers = require('./helpers');
|
|
6
|
|
7 const ENV = process.env.NODE_ENV = process.env.ENV = 'production';
|
|
8
|
|
9 module.exports = webpackMerge(commonConfig, {
|
|
10 devtool: 'source-map',
|
|
11
|
|
12 output: {
|
|
13 path: helpers.root('dist'),
|
|
14 publicPath: '/',
|
|
15 filename: '[name].[hash].js',
|
|
16 chunkFilename: '[id].[hash].chunk.js'
|
|
17 },
|
|
18
|
|
19 plugins: [
|
|
20 new webpack.NoEmitOnErrorsPlugin(),
|
|
21 new webpack.optimize.UglifyJsPlugin({ // https://github.com/angular/angular/issues/10618
|
|
22 mangle: {
|
|
23 keep_fnames: true
|
|
24 }
|
|
25 }),
|
|
26 new ExtractTextPlugin('[name].[hash].css'),
|
|
27 new webpack.DefinePlugin({
|
|
28 'process.env': {
|
|
29 'ENV': JSON.stringify(ENV)
|
|
30 }
|
|
31 }),
|
|
32 new webpack.LoaderOptionsPlugin({
|
|
33 htmlLoader: {
|
|
34 minimize: false // workaround for ng2
|
|
35 }
|
|
36 })
|
|
37 ]
|
|
38 });
|