forked from rubiin/ultimate-nest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack-hmr.js
26 lines (25 loc) · 833 Bytes
/
webpack-hmr.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
const nodeExternals = require('webpack-node-externals');
const { RunScriptWebpackPlugin } = require('run-script-webpack-plugin');
module.exports = function (options, {HotModuleReplacementPlugin, WatchIgnorePlugin}) {
return {
...options,
entry: ['webpack/hot/poll?100', options.entry],
externals: [
nodeExternals({
allowlist: ['webpack/hot/poll?100'],
}),
],
node: {
__dirname: true,
__filename: true,
},
plugins: [
...options.plugins,
new HotModuleReplacementPlugin(),
new WatchIgnorePlugin({
paths: [/\.js$/, /\.d\.ts$/],
}),
new RunScriptWebpackPlugin({ name: options.output.filename, autoRestart: false }),
],
};
};