Open mshustov opened 3 years ago
Pinging @elastic/kibana-core (Team:Core)
Not sure we can gain much with async loading UI components in core, as we are just delegating to EUI which is already a shared dep.
E.g
overlays/banners
The banners
service is already lazy loading react-markdown
The rest of the UI component in UserBannerService
is mostly using EUI. Async loading that would be a gain of less than 1kb.
overlays/flyouts
Only UI component here is
As @elastic/eui
is already a shared dep, we wouldn't gain anything here
overlays/modal
Same, UI comp is only a passthough to EUI
notifications/toasts
The toast list is currently rendered during startup
Changing to lazy load would force us to adapt the code to only render the component when a first toast is actually received.
Also GlobalToastList
is a very thin wrapper around EUI's EuiGlobalToastList
, and as @elastic/eui
is already in the shared deps, the gain would only be of a few bytes.
So I don't think we should do anything for overlays/banners
fatal_errors
Opened a PR https://github.com/elastic/kibana/pull/96020 to try that one. I guess the gain will be negligible too, but waiting for CI.
Parent issue https://github.com/elastic/kibana/issues/95853
Core bundle size is critical for performance because it's loaded on every page and delays all other plugin initialization affecting perceived UI performance.
There are still lots of options to improve Core bundle size, just a few ideas:
@kbn/std
tokbn-ui-shared-library
https://github.com/elastic/kibana/pull/95894@elastic/safer-lodash-set
tokbn-ui-shared-library
https://github.com/elastic/kibana/pull/95894node-libs-browser
from the build,util
usage https://github.com/elastic/kibana/blob/e91d0d4a76e0f61f243b65b79b99b28563dfa570/src/core/public/fatal_errors/get_error_info.ts#L9Sha256
that usesBuffer
and requires the polyfill (~40kB): https://github.com/elastic/kibana/blob/4681a80317176543535bfdb2188d94aa40d741fc/src/core/public/utils/crypto/sha256.ts#L77css
built-in bycss-loader
We don't aim to abide by the 100KB limit set for plugins. The limit bundle size value for Core should be investigated as a part of this issue.