react-redux-typescript-boilerplate icon indicating copy to clipboard operation
react-redux-typescript-boilerplate copied to clipboard

Updating to React 17 and Webpack 5

Open LuchoTurtle opened this issue 4 years ago • 0 comments

Hey there @rokoroku 👋 !

Cheers for the amazing repo! It's bloody amazing and quite useful to get something started with React!

This PR is meant to update every dependency, including migration to React 16 and Webpack from v4 to v5. The latter implies changing the webpack.config.js file. I've followed the migration guide from Webpack and their recommended practices and put them here! 😄

Most importantly:

  • Changed every occurrence from '[hash]' to '[content]', as recommended from the aforementioned guide. This also deals with caching, so we don't need to worry about different environments.
  • Added Asset Modules, replacing url-loader, raw-loader and file-loader - also recommended in the guide.
  • Rule.query (deprecated since v3) → Rule.options/UseEntry.options

  • loader.options -> loader.postcssOptions
  • Changed splitChunks.name from false to true as recommended here.
  • Removed the need for the node.fs workaround, since it's sorted in Webpack 5.
  • Changed devtool in development mode from cheap-module-eval-source-map to eval-cheap-module-source-map, since it was a breaking change in the latest version of Devtool.
  • The disable property from MiniCssExtractPlugin was removed. So we are conditionally adding it to the plugins array depending on build type (production or development) to mimick the same logic you previously had.

Hopefully you can merge this PR so everyone can benefit from an updated version of this amazing repo! 😃

LuchoTurtle avatar Jul 24 '21 22:07 LuchoTurtle