当我将react-dev-utils更新到@next版本时。我找不到 typescriptFormatter 和 WatchMissingNodeModulesPlugin

faw*_*ell 15 webpack create-react-app

当将 webpack 从 4 更新到 5 时,出现错误:

TypeError: message.split is not a function
Run Code Online (Sandbox Code Playgroud)

这是被扔进去的react-dev-utils/formatWebpackMessages.js

然后我更新react-dev-utils@next修复此问题的版本。

但是在该@next版本中,没有WatchMissingNodeModulesPlugintypescriptFormatterin ,它们在我正在使用 的文件react-dev-utils中使用。webpack.config.jswebpack4

我该如何解决这个问题,或者我的打字稿项目中是否需要这两个实用程序?

谁能给我一个webpack.config.js使用 webpack5 的 typescript 项目的模板?

Mo *_*igi 32

我也有这个问题。

他们最终删除了WatchMissingNodeModulesPluginWebpack 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文件进行相同的更改。