-
Notifications
You must be signed in to change notification settings - Fork 4
/
webpack.dev.config.js
59 lines (56 loc) · 1.68 KB
/
webpack.dev.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
var path = require('path');
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var env = 'development';
var config = {
devtool: 'eval-source-map',
resolve: {
extensions: ['', '.ts', '.js']
},
entry: {
app: [
path.resolve(__dirname, 'src/app/main.ts')
],
vendor: [
path.resolve(__dirname, 'src/app/vendor.ts')
]
},
output: {
path: path.join(__dirname, '/dist/'),
filename: '[name].bundle.js',
sourceMapFilename: '[name].bundle.map',
chunkFilename: '[id].chunk.js'
},
module: {
preLoaders: [
{ test: /\.ts$/, loader: "source-map-loader" }
],
loaders: [
{ test: /\.ts$/, exclude: /node_modules/, loaders: ['ts'] },
{ test: /\.json$/, loaders: ['json'] },
{ test: /\.css$/, loader: 'style!css' },
{ test: /\.html$/, loader: 'raw' }
],
noParse: [ /angular2-polyfills/ ]
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new ExtractTextPlugin("styles.css"),
new HtmlWebpackPlugin({
template: 'src/index.html',
inject: 'body'
}),
new webpack.optimize.CommonsChunkPlugin({ name: 'vendor', filename: 'vendor.bundle.js', minChunks: Infinity }),
new webpack.DefinePlugin({
'process.env': {
'ENV': JSON.stringify(env),
'NODE_ENV': JSON.stringify(env)
}
})
],
devServer: {
historyApiFallback: true
}
};
module.exports = config;