-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.dev.config.js
52 lines (50 loc) · 1.33 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
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var HotModuleReplacementPluginConfig = new webpack.HotModuleReplacementPlugin();
var HTMLWebpackPluginConfig = new HtmlWebpackPlugin({
template: __dirname + '/public/index.html',
filename: 'index.html',
inject: 'body'
});
module.exports = {
entry: [
'webpack-dev-server/client?http://0.0.0.0:3000', // WebpackDevServer host and port
'webpack/hot/only-dev-server', // "only" prevents reload on syntax errors
'babel-polyfill',
'./public/index.js'
],
output: {
path: __dirname + '/public',
publicPath: '/',
filename: 'index_bundle.js'
},
module: {
loaders: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
loaders: ['react-hot-loader', 'babel-loader?presets[]=es2015,presets[]=react']
},
{
test: /\.(styl|css)$/,
loaders: ['style-loader', 'css-loader?url=false', 'stylus-loader']
},
{
test: /\.txt$/,
loaders: ['react-hot-loader', 'raw-loader']
},
{
test: /\.json$/,
loaders: ['json-loader']
}
]
},
resolve: {
alias: { 'react/lib/ReactMount': 'react-dom/lib/ReactMount' },
extensions: ['.js', '.jsx'],
},
plugins: [
HotModuleReplacementPluginConfig,
HTMLWebpackPluginConfig,
]
};