-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
50 lines (47 loc) · 1.29 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
const path = require('path');
const CommonsChunkPlugin = require('webpack/lib/optimize/CommonsChunkPlugin');
const DefinePlugin = require('webpack/lib/DefinePlugin');
const ENV = process.env.NODE_ENV = 'development';
const HOST = process.env.HOST || 'localhost';
const PORT = process.env.PORT || 8080;
const metadata = {
env : ENV,
host: HOST,
port: PORT
};
module.exports = {
debug: true,
devServer: {
contentBase: 'src',
historyApiFallback: true,
host: metadata.host,
port: metadata.port
},
devtool: 'source-map',
entry: {
'main' : './src/main.ts',
'vendor': './src/vendor.ts'
},
module: {
loaders: [
{test: /\.css$/, loader: 'raw', exclude: /node_modules/},
{test: /\.css$/, loader: 'style!css?-minimize', exclude: /src/},
{test: /\.html$/, loader: 'raw'},
{test: /\.ts$/, loaders: [
{loader: 'ts', query: {compilerOptions: {noEmit: false}}},
{loader: 'angular2-template'}
]}
]
},
output: {
path : './dist',
filename: 'bundle.js'
},
plugins: [
new CommonsChunkPlugin({name: 'vendor', filename: 'vendor.bundle.js', minChunks: Infinity}),
new DefinePlugin({'webpack': {'ENV': JSON.stringify(metadata.env)}})
],
resolve: {
extensions: ['', '.ts', '.js']
}
};