-
Notifications
You must be signed in to change notification settings - Fork 167
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
Support lazy loading dependencies for views #5537
Comments
I would like to suggest one addition, unless it's already implemented to deal with #5509: All What this means in practice is that any omissions wouldn't cause a broken application, but only that the end user has to download an additional chunk that might be larger than necessary. |
Technical Considerations:
|
Considerations about issues that the implementation should cover related with missing imports: [1] cannot cover all uses cases because of injection, reflection, etc cases |
This probably will be affected by using Webpack 5 #6773 especially if we choose to support module federation feature. |
What would that impact be? My understanding is that code splitting isn't directly tied to anything in Webpack except the fact that dynamic |
If you need any info on module federation, let me know :) |
Thanks @ScriptedAlchemy! Our team is currently busy on other topics, but we should probably get back to the front-end build soon, hopefully during the summer, as that is an area we get a lot of complaints about. We also hope that Webpack 5 would make the build faster for Vaadin developers. |
While trying to get the ModuleFederation to work I've stumbled upon the case that when I have 2 module federations with exposed components where both have and reference to polymer elements e.g. I haven found out how to get all the modules to understand the polymer share. I have a sample project at If you have any hints on what should be done so that the polymer elements would be actually shared it would be much appreciated. |
Check my examples repo. You might not be sharing with semver so webpack doesn't know to use a singleton |
Hi, I this the same as fragmenting? If so, I would be interested in seeing this added to the latest version of Vaadin 14. Before the upgrade to Vaadin 14 we fragmented the views to make our login view much smaller. Now this will load the whole project on the initial load of the login view. It seems like a step back, upgrading Vaadin to run better but it makes our application slower on the initial load. |
Let's merge some info from here and there into this issue. Things have changed a bit in the last years so here's what I think should be done now:
|
I would suggest to make |
It would have to use a sha hash or similar as the key so it does not leak routing information |
The reason for having It is likely that the exact algorithm of building chunks per route need some tuning after testing also because creating a lot of small chunks is of no benefit, then it is better to merge everything or even eagerly load the components. |
Your example would be the perfect reason why I would go with the opposite default: people that need this feature could easily add it and default application where the bundle is kinda small (excluding charts and stuff) would not really get much benefit from it and therefore are optimized / de-optimized for "nothing". |
I am curious when you say "people that need this feature". The opposite of this feature is to load all dependencies of a given route upfront even if the view is never visited. Who needs that ever? |
If you use just "stock Vaadin components", I would argue that most of the components are so lightweight that it doesn't matter and people that wanna include external / Npm based components via Annotation on Views should think about it / know about the possibility to change it to load lazily. |
All else being equal, a smaller download size is better than a bigger download size. It doesn't if the difference is sometimes small if there are no obvious drawbacks from splitting. Are we aware of any such drawbacks? |
This is now implemented as follows:
|
As described in #5339 we should be able to produce chunks per each view.
Acceptance criteria
frontend/my-view.js
filefrontend/generated-flow-imports.js
should import all those fragments.frontend/generated-flow-imports.js
filefrontend/generated-flow-imports.js
should not load any chunk, but have a function reference so as server can do itThe text was updated successfully, but these errors were encountered: