forked from kozlice/angular2-webpack-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.prod.js
45 lines (37 loc) · 892 Bytes
/
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
44
45
'use strict';
/**
* TODO: Comments
*/
const webpack = require('webpack');
const ENV = process.env.ENV = process.env.NODE_ENV = 'prod';
let config = require('./webpack.config.common');
config.devtool = 'source-map';
config.output = {
path: './dist',
publicPath: '/',
filename: '[name].[hash].js',
chunkFilename: '[id].[hash].chunk.js',
sourceMapFilename: '[name].[hash].map'
};
/**
* TODO: Remove comments from resulting JS files
*/
/**
* TODO: Something better?
*/
config.htmlLoader = {minimize: false};
config.plugins.push(
new webpack.NoErrorsPlugin(),
new webpack.optimize.DedupePlugin(),
new webpack.optimize.UglifyJsPlugin()
);
/**
* Same purpose as in dev config.
*/
config.plugins.push(new webpack.DefinePlugin({
'ENV': JSON.stringify(ENV),
'process.env': {
'ENV': JSON.stringify(ENV)
}
}));
module.exports = config;