profile
viewpoint

Ask questionsRoute based code splitting, Loading chunk 0 failed after new deployment

We are using Suspense and route based code splitting with react 16. This uses Webpack chunks to split the code into smaller bits for different routes in the application. In production mode this produces chunks with a hash named something like 7.8817be1b.chunk.js.

The issue is that when we deploy a new production release users with the app open who client side navigate to a page requiring a new chunk get an error (they have the old bundle, so they are requesting an old no-longer existing chunk).

We are not too sure how to deal with this error, does react have any guidance around what we should do with existing users who are requesting old chunks? Can some guidance about this be added to the docs: https://reactjs.org/docs/code-splitting.html

React: 16.12.0

facebook/react

Answer questions aweary

We try to use this issue tracker for bug reports and feature requests for React only. While this may be an issue you encounter following the official guidance on the React website, it doesn't mean that it's a problem with React itself. As @threepointone said, this is a problem that occurs with bundling and code-splitting in general. I recommend checking out the list of great support resources listed on the doc page, Where to Get Support.

useful!

Related questions

Disable react strict mode on third party libraries hot 3
Warning: validateDOMNesting(...): <tr> cannot appear as a child of <table> hot 2
Warning: Unknown DOM property for. Did you mean htmlFor? hot 2
React@16.9 block `javascript:void(0);` hot 2
React custom hook "Should have a queue. This is likely a bug in React" error message. hot 1
TypeError: Object(...) is not a function hot 1
useEffect causes 'callback is not a function' exception hot 1
DevTools: Updating state or props in devtools does not trigger component update. hot 1
Invariant Violation: Invalid hook call. Hooks can only be called inside of the body of a function component hot 1
eslint-plugin-react-hooks v2.0.0 is not loaded correctly. hot 1
Old references retained by memoizedProps in fiber hot 1
Stale values for useState inside callback functions hot 1
ReactDomServer - renderToString Failing with Context Provider on IE11 hot 1
Keep getting `TypeError: Cannot read property 'scrollTop' of null` in a custom hook... hot 1
map through connected component, get data of last saga call within all componenets hot 1
Github User Rank List