Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webpack-hot-server-middleware and react-loadable #48

Open
amangeot opened this issue Nov 16, 2017 · 4 comments
Open

webpack-hot-server-middleware and react-loadable #48

amangeot opened this issue Nov 16, 2017 · 4 comments

Comments

@amangeot
Copy link

Hello,
I can't get react-loadable to work with this really cool package for code splitting.

Has anyone managed to do it and could suggest how to do it? Or share an example?

Thank you!

@richardscarrott
Copy link
Member

richardscarrott commented Nov 23, 2017

I'm using react-loadable in the 60fram.es boilerplate, e.g. https://github.com/60frames/react-boilerplate/blob/master/src/components/index/IndexLoadable.js

NOTE: It uses an older version of react-loadable, a more recent version I used on another project required the use of their babel plugin or you need to manually faff around with import-inspector

The key is to disable code splitting when SSRing with:

new webpack.optimize.LimitChunkCountPlugin({
    maxChunks: 1
})

@amangeot
Copy link
Author

amangeot commented Dec 4, 2017

I eventually have the time to look at the boilerplate, it sounds very promising, thank you @richardscarrott

Have you considered webpack v3, react-router v4 and react-loadable v5?

I'd like to use the last versions, did you encounter any issue with those for SSR with data fetching and code splitting?

@richardscarrott
Copy link
Member

richardscarrott commented Dec 27, 2017

I've got code splitting working on a private project using Webpack v3 and react-loadable v5, no real problems with those.

I've avoided upgrading to React Router v4 on any projects because the departure from a centralised config means it's no longer possible to match components before rendering to determine data dependencies.

I've heard https://github.com/ReactTraining/react-router/tree/master/packages/react-router-config is a potential solution but tbh it doesn't seem like it has first class support from the react-router team.

@hedgepigdaniel
Copy link

Check out react-universal-component, redux-first-router, and redux-first-router-demo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants