NestJS 热模块替换:无效的选项对象
NestJS Hot Module Replacement: Invalid options object
我正在使用 NestJS 并尝试按照此页面的说明安装热模块替换:https://docs.nestjs.com/recipes/hot-reload
由于我使用的是 Nest CLI,因此我遵循了页面的第一部分。但是,目前我必须使用 nest build --webpack --webpackPath webpack-hmr.config.js
命令,但出现以下错误:
Error Invalid options object. Watch Ignore Plugin has been initialized using an options object that does not match the API schema.
- options[0] misses the property 'paths'. Should be:
[RegExp | string, ...] (should not have fewer than 1 item)
-> A list of RegExps or absolute paths to directories or files that should be ignored.
- options[1] misses the property 'paths'. Should be:
[RegExp | string, ...] (should not have fewer than 1 item)
-> A list of RegExps or absolute paths to directories or files that should be ignored.
有谁知道它可能来自哪里以及如何解决它?
问题似乎来自从 webpack 4 到 webpack 5 的更新:https://github.com/nestjs/nest/issues/5667
有2种解决方案:
- 等待
start-server-webpack-plugin
更新,同时不使用HMR
- 降级到 webpack 4
我正在使用 NestJS 并尝试按照此页面的说明安装热模块替换:https://docs.nestjs.com/recipes/hot-reload
由于我使用的是 Nest CLI,因此我遵循了页面的第一部分。但是,目前我必须使用 nest build --webpack --webpackPath webpack-hmr.config.js
命令,但出现以下错误:
Error Invalid options object. Watch Ignore Plugin has been initialized using an options object that does not match the API schema.
- options[0] misses the property 'paths'. Should be:
[RegExp | string, ...] (should not have fewer than 1 item)
-> A list of RegExps or absolute paths to directories or files that should be ignored.
- options[1] misses the property 'paths'. Should be:
[RegExp | string, ...] (should not have fewer than 1 item)
-> A list of RegExps or absolute paths to directories or files that should be ignored.
有谁知道它可能来自哪里以及如何解决它?
问题似乎来自从 webpack 4 到 webpack 5 的更新:https://github.com/nestjs/nest/issues/5667
有2种解决方案:
- 等待
start-server-webpack-plugin
更新,同时不使用HMR - 降级到 webpack 4