我正在使用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
有两种解决方案:
- 等待
start-server-webpack-plugin
更新,同时不使用HMR - 降级到webpack 4