-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathwebpack-hmr.config.js
43 lines (41 loc) · 1.19 KB
/
webpack-hmr.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
const nodeExternals = require('webpack-node-externals');
const { RunScriptWebpackPlugin } = require('run-script-webpack-plugin');
module.exports = (options, webpack) => {
// remove ForkTsCheckerWebpackPlugin
const plugins = options.plugins.filter((plugin) => {
return plugin.constructor.name !== 'ForkTsCheckerWebpackPlugin';
});
return {
...options,
entry: ['webpack/hot/poll?100', options.entry],
externals: [
nodeExternals({
allowlist: ['webpack/hot/poll?100'],
}),
],
module: {
rules: [
{
test: /.tsx?$/,
use: 'swc-loader',
exclude: /node_modules/,
// todo: fix swc-loader compatible
// options: {
// getCustomTransformers: (program) => ({
// before: [require('@nestjs/swagger/plugin').before({}, program)],
// }),
// },
},
],
},
plugins: [
...plugins,
new webpack.HotModuleReplacementPlugin(),
new webpack.WatchIgnorePlugin({
paths: [/\.js$/, /\.d\.ts$/],
}),
new RunScriptWebpackPlugin({ name: options.output.filename, autoRestart: false }),
],
mode: 'development',
};
};