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

[meta] Reduce App Services bundle sizes #112832

Closed
6 of 16 tasks
Tracked by #88678
Dosant opened this issue Sep 22, 2021 · 5 comments
Closed
6 of 16 tasks
Tracked by #88678

[meta] Reduce App Services bundle sizes #112832

Dosant opened this issue Sep 22, 2021 · 5 comments
Labels
impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. loe:small Small Level of Effort Meta

Comments

@Dosant
Copy link
Contributor

Dosant commented Sep 22, 2021

Initial bundle size of the app services plugins need to get under 100Kb:

Also can be improved:

You can learn why this is important and how to analyze bundle size here https://www.elastic.co/guide/en/kibana/current/plugin-performance.html

One direction how we will approach this is by introducing an "Async registry" concept #65993 which will encourage all registered items to be loaded async. This will not only help app services bundles but will benefit bundles of everyone who adds items to our registries.

Besides taking care of our registries, there are definitely still a bunch of lower-hanging fruits. Things to take care of first:

  • Pay attention to React components included into the initial bundle. Those are easy to convert into a lazy component with Suspense. example
  • Pay attention to heavy client-side dependencies. Possibly those can be replaced with lighter alternatives or loaded lazily. For example, take a look at uiActionsEnhanced bundle which include handlebars example
  • Pay attention to dead code, test code and example code. For example, embeddable plugin includes example samples example
  • Avoid export * to not accidentally re-export not needed code as part of the initial bundle
  • Prefer importing/exporting only types (type) if possible example
  • Sometimes we use node js APIs in common/client-side code without realizing that. This works because of auto-polyfill. Polyfill could weigh a lot. Try to avoid this or use lighter alternatives: example
  • When using lodash, make sure you import from lodash and not from lodash/*. That's because full lodash is already included into shared deps.
  • Try to import scss into async chunks together with components. Avoid importing in plugin root.
  • Consider moving static code to a package and import into async chunk
  • When looking at registries, consider not doing anything custom that could otherwise be solved by Async registries  #65993 unless there is a large win and clear async point for making loading code async (like here inside embeddable factory
    const { VisualizeEmbeddable } = await import('./visualize_embeddable');
    )
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app-services (Team:AppServices)

@Dosant Dosant changed the title App services bundle size reduction App services bundle size reduction[ Sep 22, 2021
@Dosant Dosant changed the title App services bundle size reduction[ [meta] App services bundle size reduction Sep 22, 2021
@exalate-issue-sync exalate-issue-sync bot added impact:low Addressing this issue will have a low level of impact on the quality/strength of our product. loe:small Small Level of Effort labels Sep 22, 2021
@Dosant Dosant removed loe:small Small Level of Effort impact:low Addressing this issue will have a low level of impact on the quality/strength of our product. labels Sep 22, 2021
@exalate-issue-sync exalate-issue-sync bot added impact:low Addressing this issue will have a low level of impact on the quality/strength of our product. loe:small Small Level of Effort labels Sep 28, 2021
@Dosant Dosant added impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. loe:x-large Extra Large Level of Effort and removed loe:small Small Level of Effort impact:low Addressing this issue will have a low level of impact on the quality/strength of our product. labels Oct 14, 2021
@exalate-issue-sync exalate-issue-sync bot added loe:medium Medium Level of Effort and removed loe:x-large Extra Large Level of Effort labels Oct 15, 2021
@exalate-issue-sync exalate-issue-sync bot added loe:small Small Level of Effort and removed loe:medium Medium Level of Effort labels Nov 17, 2021
@mattkime
Copy link
Contributor

@Dosant was this closed by accident? Exalate is good at that.

@exalate-issue-sync exalate-issue-sync bot reopened this Jan 11, 2022
@petrklapka
Copy link
Member

@mattkime No... It was me. I got a little overzealous in cleaning up Jira Epics that were not on our roadmap and I closed it because it had no child tasks. There's plenty to still do on this, so I've re-opened it, set it to show on the roadmap, and we need to attach issues/tasks that it references as children so we can manage the tasking.

@lizozom lizozom changed the title [meta] App services bundle size reduction [meta] Reduce App Services bundle sizes Apr 18, 2022
@lizozom
Copy link
Contributor

lizozom commented Sep 6, 2022

@Dosant is this issue still relevant? Think we can close it in the meanwhile

@Dosant
Copy link
Contributor Author

Dosant commented Sep 6, 2022

Further work is not planned. we can close and reopen when needed

@Dosant Dosant closed this as completed Sep 6, 2022
@Dosant Dosant closed this as not planned Won't fix, can't repro, duplicate, stale Sep 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. loe:small Small Level of Effort Meta
Projects
None yet
Development

No branches or pull requests

5 participants