Can I turn off create-react-app chunking mechanism?

Darko picture Darko · Apr 29, 2019 · Viewed 11k times · Source

I am setting up my React app project using create-react-app.

I was wondering if there is a way to turn-off the chunking mechanism that is built-in into the react scripts. The thing is that I need to fix the name of the bundle created on the build.

Answer

Darko picture Darko · Apr 30, 2019

I've found that you can disable chunking by setting splitChunks webpack configuration. For more details check https://github.com/facebook/create-react-app/issues/5306#issuecomment-431431877

However, this does not remove the contenthash part from the bundle name and you will still have that random string in the name.

To remove this, go to your webpack.config and edit the bundle name

'static/js/[name].[contenthash:8].js' => 'static/js/[name].js'