-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
53 lines (49 loc) · 1.24 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
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var appEntry = './src/main.ts';
if (process.env.APP_ENVIRONMENT === 'production') {
appEntry = './src/main-aot.ts';
}
module.exports = {
entry: {
'app': appEntry,
'polyfills': [
'core-js/es6',
'core-js/es7/reflect',
'zone.js/dist/zone'
]
},
output: {
path: __dirname + '/dist',
filename: '[name].[hash].js'
},
module: {
loaders: [
{test: /\.component.ts$/, loader: 'ts!angular2-template'},
{test: /\.ts$/, exclude: /\.component.ts$/, loader: 'ts'},
{test: /\.html$/, loader: 'raw'},
{test: /\.css$/, loader: 'raw'}
]
},
resolve: {
extensions: ['.js', '.ts', '.html', '.css']
},
plugins: [
// see https://github.com/angular/angular/issues/11580
new webpack.ContextReplacementPlugin(
/angular(\\|\/)core(\\|\/)(esm(\\|\/)src|src)(\\|\/)linker/,
'./src'
),
new webpack.optimize.CommonsChunkPlugin({
name: 'polyfills'
}),
new HtmlWebpackPlugin({
template: './src/index.html'
}),
new webpack.DefinePlugin({
app: {
environment: JSON.stringify(process.env.APP_ENVIRONMENT || 'development')
}
})
]
};