-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.dev.config.js
45 lines (35 loc) · 1.15 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
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const constants = require('./webpack-constants');
const webpackConfig = require('./webpack.config.js');
const { plugins, entry } = webpackConfig;
const { loaders } = webpackConfig.module;
const { DEV_SERVER_PORT } = constants;
const DEV_SERVER_HOST = `http://localhost:${DEV_SERVER_PORT}`;
module.exports = Object.assign({}, webpackConfig, {
entry: {
index: [
`webpack-dev-server/client?${DEV_SERVER_HOST}`,
'webpack/hot/only-dev-server'
].concat(entry.index),
},
module: {
loaders: [{
test: /\.js$/,
exclude: /node_modules/,
loaders: ['react-hot', 'babel']
}].concat(loaders)
},
plugins: plugins.concat([
new HtmlWebpackPlugin({
template: './templates/index.ejs',
inject: false,
serviceWorker: `/${constants.SERVICE_WORKER_FILENAME}`
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.OldWatchingPlugin() // VM issues
]),
devServer: {
port: DEV_SERVER_PORT
}
});