forked from tsaiDavid/simple-redux-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.dev.js
63 lines (62 loc) · 1.9 KB
/
webpack.config.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
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
60
61
62
63
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
devtool: 'cheap-module-eval-source-map',
entry: [
'eventsource-polyfill', // necessary for hot reloading with IE
'webpack-hot-middleware/client',
'./src/index'
],
output: {
path: path.join(__dirname, 'dist'),
filename: '[name]-[hash].js',
publicPath: '/'
},
plugins: [
/**
* This is where the magic happens! You need this to enable Hot Module Replacement!
*/
new webpack.HotModuleReplacementPlugin(),
/**
* NoErrorsPlugin prevents your webpack CLI from exiting with an error code if
* there are errors during compiling - essentially, assets that include errors
* will not be emitted. If you want your webpack to 'fail', you need to check out
* the bail option.
*/
new webpack.NoErrorsPlugin(),
/**
* This is a webpack plugin that simplifies creation of HTML files to serve your
* webpack bundles. This is especially useful for webpack bundles that
* include a hash in the filename which changes every compilation.
*/
new HtmlWebpackPlugin({
template: 'index.html',
filename: 'index.html',
title: 'Simple Redux Boilerplate',
inject: 'body'
}),
/**
* DefinePlugin allows us to define free variables, in any webpack build, you can
* use it to create separate builds with debug logging or adding global constants!
* Here, we use it to specify a development build.
*/
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development')
}),
],
module: {
loaders: [
{
test: /\.js?/,
exclude: [/node_modules/, /styles/],
loaders: ['babel'],
include: path.join(__dirname, 'src')
},
{
test: /\.scss$/,
loader: 'style!css!sass'
}
]
}
};