Closed pklicnik closed 8 years ago
@pklicnik is the change needed on the server or client side of react-engine?
@samsel Client side.
See PR #129 for my workaround. Note: I didn't fully test all scenarios, so tweak as needed
+1
merged & published v3.1.0 with the change!
Our routes file is configured to use
require.ensure
so we can code-split our page into separate chunks using webpack. Eg:Server-side rendering succeeds without error, but an error appears in the console when mounted on the client:
After debugging through the issue, this seems to be a problem/bug/limitation in react-router.
As a work around, you need to wrap the call to
render
insidematch
to pre-load the routes configuration on the client. Snippet of the change needed on the react-engine sideSolution is discussed here: https://github.com/rackt/react-router/issues/2036#issuecomment-153541487
Example provided here: https://github.com/rackt/example-react-router-server-rendering-lazy-routes