Search code examples
webpackcreate-react-app

When I update react-dev-utils to the @next version. I can't find typescriptFormatter and WatchMissingNodeModulesPlugin


when updating webpack from 4 to 5, I got the error:

TypeError: message.split is not a function

which is thrown in react-dev-utils/formatWebpackMessages.js.

Then I update react-dev-utils to then @next version which fix this.

However in the @next version, there are no WatchMissingNodeModulesPlugin and typescriptFormatter in react-dev-utils, and they are used in my webpack.config.js file which is working with webpack4.

How can I fix this or do I need these two utils in my typescript project?

Can anyone give me a template of webpack.config.js for a typescript project using webpack5?


Solution

  • I had this issue too.

    They endedup removing WatchMissingNodeModulesPlugin for Webpack 5 so you have to remove its usage too. It will be a similar change to this PR: https://github.com/facebook/create-react-app/pull/11170/files

    Similarly, typescriptFormatter was removed in this change: https://github.com/facebook/create-react-app/pull/10004
    For this one you'll need to make the same changes to the webpack.config.js file.