-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.dev.js
30 lines (27 loc) · 1 KB
/
webpack.dev.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
var path = require('path');
var webpack = require('webpack');
var baseWebpackConfig = require('./webpack.base.js');
var merge = require('webpack-merge');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
// add hot-reload related code to entry chunks
Object.keys(baseWebpackConfig.entry).forEach(function (name) {
baseWebpackConfig.entry[name] = ['webpack-dev-server/client?http://127.0.0.1:3000', 'webpack/hot/only-dev-server'].concat(baseWebpackConfig.entry[name]);
})
baseWebpackConfig.plugins.push(
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('development')
}
}),
new webpack.optimize.CommonsChunkPlugin('commons', 'commons.js'),
new ExtractTextPlugin('[name].css'),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.HotModuleReplacementPlugin()
);
module.exports = merge(baseWebpackConfig, {
devtool: '#inline-source-map',
output: {
path: path.join(__dirname),
filename: '[name].js',
}
})