Closed
Description
Is this a bug report?
Yes
Can you also reproduce the problem with npm 4.x?
Yes
Which terms did you search for in User Guide?
progressive web app service workers
Environment
node -v
: 8.4.0npm -v
: 5.6.0yarn --version
(if you use Yarn):npm ls react-scripts
(if you haven’t ejected): 1.0.17
Then, specify:
- Operating system: Windows 10
- Browser and version (if relevant): Chrome 63
Steps to Reproduce
- Set up a default CRA project
- Install
react-loadable
to code-split a certain React component on the page - Build, serve and navigate to the page
- Modify the component earlier (to change the generated hash)
- Build, serve and reload the page
Expected Behavior
The new version of the code-splitted component should be loaded correctly.
Actual Behavior
The installed service worker tries to fetch the old component chunk instead of the new one, resulting in a failure to load the new chunk. This is because the hash has changed since the last time the service worker was installed. Because of this react-loadable
interprets the error and refuses to display the new page, resulting in a blank page.
This is less than ideal, and the only thing I could come up is to force a reload on the homepage. This will trigger the new service worker to be installed which results in the correct component/chunk being loaded.