Server Side rendering example?
tconroy opened this issue · 2 comments
tconroy commented
This medium post and this repo are the cleanest examples of code splitting I've found, so thank you!
One thing I'd like to request is an example of a server side implementation, where the initial state is set by the server and returned to the client with the appropriate bundles.
jfresco commented
@tconroy I could make SSR work by changing a little bit the getComponent
functions. It works in my setup, I didn't try it in this project.
getComponent(location, cb) {
if (process.env.IS_BROWSER) {
System.import('pages/Home').then(loadRoute(cb)).catch(errorLoading);
} else {
cb(null, require('pages/Home').default))
}
}