-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
lazy loading for infra assets #62363
lazy loading for infra assets #62363
Conversation
Pinging @elastic/logs-metrics-ui (Team:logs-metrics-ui) |
@@ -75,9 +66,10 @@ export class Plugin | |||
mount: async (params: AppMountParameters) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a reason we don't just stick this whole function behind an async import?
mount: async (params: AppMountParameters) => {
(await import('./apps/mount'))(core, params);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just think it would be a lot easier to implement correctly and maintain if everything was behind the await, not individual things being places behind the await
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I will adopt this pattern in other plugins with less logic in the mount function. I'm not comfortable touching the plugin code here due to multiple dependencies between rendering functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We agree and will clean up the mess for this plugin in a follow-up (#62413).
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can confirm that the eagerly loaded bundle size of the infra
plugin in the production build is only about 3 Mbytes:
The Logs and Metrics apps seem to load and function correctly.
Thank you for improving that for us. As said in a different comment, we'll refactor the entry point to reduce the eagerly loaded bundle size further.
Summary
Part of #62263
Reduces plugin chunk size from 6.4Mb to 3.3Mb
Downloads other chunks on page mount