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:

2018-02-11 2 47 56

BTW, if I remove the loadComponents().then( ... ) from my client.js the error gone but another error occurs as following:

2018-02-11 2 59 16

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

Most upvoted comments

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 loadableState you get has a tree properties, 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?