-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
69 lines (60 loc) · 1.7 KB
/
webpack.config.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const appSrcDirectory = __dirname + "/src";
const loaders = require('./webpack/loaders');
const isProdMode = global.__IS_PROD_MODE__ = process.env['NODE_ENV'] === 'prod';
var devPlugins = [];
if (isProdMode) {
devPlugins = [
new webpack.NoErrorsPlugin(),
// new webpack.optimize.DedupePlugin(),
new webpack.optimize.UglifyJsPlugin({
minimize: true,
debug: false,
mangle: {
keep_fnames: true
}
}),
];
}
/**
* @type {webpack.Configuration}
*/
const config = {
devtool: 'source-map',
context: appSrcDirectory,
entry: {
app: appSrcDirectory + '/bootstrap.ts',
// vendor: appSrcDirectory + '/vendor.ts',
polyfills: appSrcDirectory + '/polyfills.ts'
},
output: {
filename: 'c.js',
path: __dirname + '/build'
},
module: {
loaders: loaders.allLoaders(appSrcDirectory)
},
resolve: {
extensions: [ ".webpack.js", ".web.js", ".js", '.ts']
},
plugins: [
new webpack.LoaderOptionsPlugin({
debug: !isProdMode
}),
new webpack.ContextReplacementPlugin(
/angular(\\|\/)core(\\|\/)@angular/,
appSrcDirectory
),
new webpack.optimize.CommonsChunkPlugin({names: [/*"vendor",*/ "polyfills"], filename: "[name].bundle.js"}),
new HtmlWebpackPlugin({
template: 'index.html',
inject: 'body'
}),
new webpack.DefinePlugin({
__IS_PROD_MODE__: isProdMode
}),
...devPlugins
]
};
module.exports = config;