-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.dev.watch.babel.js
45 lines (40 loc) · 1.24 KB
/
webpack.config.dev.watch.babel.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
'use strict';
import webpack from 'webpack';
import webpackDevMiddleware from 'webpack-dev-middleware';
import webpackHotMiddleware from 'webpack-hot-middleware';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import { customizer, MODULE_NAME } from './webpack.config.base.babel';
import webpackDevConfig from './webpack.config.dev.babel';
import * as fp from 'lodash/fp';
const webpackDevWatchConfig = fp.mergeWith(customizer, {
entry: {
[MODULE_NAME]: [
'webpack-hot-middleware/client?path=/__webpack_hmr&timeout=20000&reload=true',
]
},
output: {
publicPath: '/'
},
watch: true, // cache: true in watch mode, helpful in incremental builds
devtool: '#cheap-module-eval-source-map',
plugins: [
new webpack.OldWatchingPlugin(), // Temp. solution for windows
new HtmlWebpackPlugin({
title: MODULE_NAME,
template: 'public/views/index.ejs'
}),
new webpack.HotModuleReplacementPlugin()
]
}, webpackDevConfig);
const compiler = webpack(webpackDevWatchConfig);
export default (app) => {
app.use(webpackDevMiddleware(compiler, {
dynamicPublicPath: true,
stats: {
colors: true,
chunks: false,
'errors-only': true
}
}));
app.use(webpackHotMiddleware(compiler));
};