将 webpack 从 4 更新到 5 时,出现错误:
TypeError: message.split is not a function
被扔进 react-dev-utils/formatWebpackMessages.js
.然后我更新
react-dev-utils
到那时 @next
解决这个问题的版本。然而在
@next
版本,没有WatchMissingNodeModulesPlugin
和 typescriptFormatter
在 react-dev-utils
, 它们用于我的 webpack.config.js
与 webpack4
一起使用的文件.我该如何解决这个问题,或者我的 typescript 项目中是否需要这两个实用程序?
谁能给我一个模板
webpack.config.js
对于使用 webpack5 的 typescript 项目?
最佳答案
我也有这个问题。
他们最终删除了 WatchMissingNodeModulesPlugin
对于 Webpack 5,因此您也必须删除它的用法。这将是与此 PR 类似的更改:
https://github.com/facebook/create-react-app/pull/11170/files
同样,typescriptFormatter
在此更改中删除:
https://github.com/facebook/create-react-app/pull/10004
为此,您需要对 webpack.config.js
进行相同的更改。文件。
关于webpack - 当我将 react-dev-utils 更新到 @next 版本时。我找不到 typescriptFormatter 和 WatchMissingNodeModulesPlugin,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68827938/