loadable-components: HMR not working
Hi,
I’m doing SSR with HMR, when trying to change lazy loaded component, the HMR works on client side, but when I tried to refresh the page, the console is showing these errors:
loadable-components.es.js:93 Uncaught Error: loadable-components: module "./NotFoundPage-1" is not found, client and server modules are not sync. You are probably not using the same resolver on server and client.
at loadable-components.es.js:93
at Array.map (<anonymous>)
at loadState (loadable-components.es.js:87)
at loadComponents (loadable-components.es.js:118)
at Object.<anonymous> (client.js:25)
at Object../src/renderer/client.js (app.js:1413)
at __webpack_require__ (bootstrap:772)
at fn (bootstrap:141)
at Object.0 (app.js:1982)
at __webpack_require__ (bootstrap:772)
How to Reproduce:
- Clone https://github.com/antonybudianto/react-ssr-starter
- npm i
- npm start
- Visit random 404 route (e.g http://localhost:3000/asdasd)
- Change
src/routes/NotFoundPage/NotFoundPage.js- This route is lazy loaded
- Notice the hot reload should work
- Refresh the page
- Error shown
Any pointers will be helpful, thank you!
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 3
- Comments: 16 (6 by maintainers)
Commits related to this issue
- fix: fix SSR with HMR #85 — committed to gregberge/loadable-components by gregberge 6 years ago
- Merge pull request #88 from smooth-code/fix-ssr-hmr fix: fix SSR with HMR #85 — committed to gregberge/loadable-components by gregberge 6 years ago
My current workaround is:
The idea is to remove the ending dash with index (“./NotFoundPage-1” -> “./NotFoundPage”), and error is gone 😄
Have the same issue 😦
Have the same issue 😦 When I import the same component in different routes, and try to reload from the server, it will appear.
and the warning
Just updated to 2.2.2 and it’s happening again. Can you help? @neoziro
Yeah it could be pretty complicated, just let go for now. I will create an issue to describe the exact problem.