-
Notifications
You must be signed in to change notification settings - Fork 227
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
Conditional loading / Lazy loading #169
Comments
I'd go with webpack's code splitting: for example, if you are using fluxible-router you could put a |
Code splitting + gzip compression helped us a ton |
Has anyone achieved this with an isomorphic app? |
We have been using webpack's code splitting by creating a Here is a code snippet of our plugin and the |
@mridgway Nice work, do you get any checksum errors? How do you avoid when the bundle is already loaded server side? |
@mridgway Can you give an example of how you use this plugin? |
@mridgway Id also like to see an example |
Has anyone managed to achieve this? The |
An example of this in an isomorphic app is https://github.com/localnerve/flux-react-example-sw. In that example, a modal action has contents that can be conditionally loaded. Specifically, the modal presents the Settings component, consisting of an action, With Webpack, you have to hard code the split (the args to require.ensure), see the repo's utils/splits Hope that helps,
|
Thanks for the example. I've been able to get lazy loading "kind of" working. I can get the bundling and conditional loading working fine. The problem is that fluxible-router requires the handler to be defined, or even if one isn't defined, it can't be added or modified later on. Or maybe it can, am I missing something? |
Maybe I'm not understanding. // RouteStore RECEIVE_ROUTES handler
_handleReceiveRoutes: function (payload) {
this._routes = Object.assign(this._routes || {}, payload);
// etc...
} |
Any plans or thoughts how to handle conditional loading?
There are a few cases where the entire app in javascript might be too big.
Async loading of the async deferred script needed for the current launched page.
Thoughts or ideas?
Require.js / Webpack
The text was updated successfully, but these errors were encountered: