annotate config/webpack.prod.js @ 60:7b9d616695d3 webpack

new setup using webpack (and Angular 4).
author casties
date Wed, 29 Mar 2017 20:58:57 +0200
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
60
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
1 var webpack = require('webpack');
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
2 var webpackMerge = require('webpack-merge');
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
3 var ExtractTextPlugin = require('extract-text-webpack-plugin');
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
4 var commonConfig = require('./webpack.common.js');
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
5 var helpers = require('./helpers');
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
6
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
7 const ENV = process.env.NODE_ENV = process.env.ENV = 'production';
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
8
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
9 module.exports = webpackMerge(commonConfig, {
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
10 devtool: 'source-map',
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
11
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
12 output: {
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
13 path: helpers.root('dist'),
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
14 publicPath: '/',
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
15 filename: '[name].[hash].js',
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
16 chunkFilename: '[id].[hash].chunk.js'
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
17 },
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
18
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
19 plugins: [
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
20 new webpack.NoEmitOnErrorsPlugin(),
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
21 new webpack.optimize.UglifyJsPlugin({ // https://github.com/angular/angular/issues/10618
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
22 mangle: {
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
23 keep_fnames: true
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
24 }
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
25 }),
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
26 new ExtractTextPlugin('[name].[hash].css'),
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
27 new webpack.DefinePlugin({
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
28 'process.env': {
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
29 'ENV': JSON.stringify(ENV)
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
30 }
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
31 }),
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
32 new webpack.LoaderOptionsPlugin({
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
33 htmlLoader: {
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
34 minimize: false // workaround for ng2
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
35 }
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
36 })
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
37 ]
7b9d616695d3 new setup using webpack (and Angular 4).
casties
parents:
diff changeset
38 });