loadable-components: [Error] Server and Client modules are not sync
Hi, I setup this library with SSR and currently I’m doing code-splitting for redux reducer based on this solution. But I encounter an error as following:
BTW, if I remove the loadComponents().then( ... ) from my client.js the error gone but another error occurs as following:
Any suggestion for it?
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 24 (11 by maintainers)
Commits related to this issue
- fix: fix SSR with HMR #85 — committed to gregberge/loadable-components by gregberge 6 years ago
I think I could make it possible by adding a
require.resolveWeak('./Bar')like React Loadable does. But right now I do not want to couple it with Webpack.I will give you a solution, you can do it if you want:
The
loadableStateyou get has atreeproperties, the solution for you is to walk the tree and try to get the full path of the module.If you got the full path of the module, you can easily load it client side.
The actual problem is that you only get the relative path of the module, so you can’t tell to Webpack “Load my module”. Do you see the problem?