-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathwebpack.config.js
63 lines (59 loc) · 1.35 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
const webpack = require("webpack");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const ENV = process.env.npm_lifecycle_event;
const JiT = ENV === 'control:jit';
if (JiT) {
console.log('AoT: False');
}
const basePlugins = [
new webpack.DefinePlugin({
"process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV)
}),
new webpack.optimize.CommonsChunkPlugin("vendor"),
new HtmlWebpackPlugin({
template: "./sandbox/index.html"
}),
new webpack.ContextReplacementPlugin(
/angular(\\|\/)core(\\|\/)(esm(\\|\/)src|src)(\\|\/)linker/,
__dirname
)
];
const prodPlugins = [
// new webpack.optimize.UglifyJsPlugin({
// mangle: {
// keep_fnames: true,
// },
// compress: {
// warnings: false,
// },
// })
];
const plugins = basePlugins
.concat((process.env.NODE_ENV === 'production') ? prodPlugins: []);
module.exports = {
entry: {
app: "./sandbox/main.ts",
vendor: [
"reflect-metadata",
"zone.js",
"@angular/core",
"@angular/compiler",
"@angular/forms",
"@angular/platform-browser-dynamic",
"ts-helpers"
]
},
output: {
path: __dirname + "/dist",
filename: "[name].[hash].js"
},
resolve: {
extensions: [".js", ".ts"]
},
module: {
rules: [
{ test: /.ts$/, loader: "awesome-typescript-loader" },
]
},
plugins: plugins
};