-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Code Splitting using Webpack or Webpack2 #1301
Comments
I am also interested if anyone has gotten code splitting working, particularly by route. |
Anyone had solution on code splitting with webpack? |
You can look this pull request: #1298 For Webpack2 config you can look my repo here: https://github.com/bertho-zero/react-redux-universal-hot-example (without code splitting) |
Is it to do code splitting as per routes? For ex each route in 1 bundle.js or some corelated routes in another bundle.js so that while app grows, page size does not increase too much? Can it solve by route? |
I just added code splitting here: src/routes.js. |
I improved code splitting on my fork: You can try it here: https://react-hot-example.herokuapp.com/ |
@bertho-zero i'm pretty sure your code splitting isn't outputting what you think. The routes.js file is correctly loading page bundles, but your webpack entry file is client.js (which loads all routes a circular dependency): i.e. i think you're actually duplicating code in app bundle and your page-specific bundle. not tested |
For anyone reading this trying to set up codesplitting, look into the webpack |
@githubjosh I think you're wrong, the size of the main bundle has decreased. |
@bertho-zero there is some problem with the server side rendering with your branch |
No, it's because the service worker serve files after the first load, you can do SHIFT+F5 for load from server (one time). |
how we can split the bundle using webpack or webpack2 into something like Vendor.js, Home.js, Others.js.
The text was updated successfully, but these errors were encountered: