-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[Lens] Reduce initial bundle size #78142
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
Conversation
|
Pinging @elastic/kibana-app (Team:KibanaApp) |
| // sass-lint:disable-block indentation, no-color-keywords | ||
|
|
||
| // SASSTODO: Create this in EUI | ||
| @mixin lnsOverflowShadowHorizontal { |
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.
Mixin and variable files should still be their own file (even if they're used by only a single component right now). Then what you do is import them in the SASS files that need them instead of relying on a manifest.
|
@cchaos Reverted mixin and variable files and import them when needed. |
| @import 'data_panel_wrapper'; | ||
| @import 'expression_renderer'; | ||
| @import 'frame_layout'; | ||
| @import 'suggestion_panel'; | ||
| @import 'workspace_panel_wrapper'; |
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.
Sorry one more thing. Only _index.scss files should be manifest files. You'll need to either revert this back to an index file or put all the imports of these files in their respective JS files.
| flex-grow: 1; | ||
| } | ||
|
|
||
| $lnsPanelMinWidth: $euiSize * 18; |
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.
This should be moved to the variables file.
|
@cchaos Split scss up into multiple files, no reason to keep an import structure for scss @wylieconlon Introduced a general re-export file to collapse the async bundles. I added the app bundle as well as this was causing cascading dynamic imports, adding a roundtrip latency. I think we can do better in general, but I think the current state is a pretty good improvement for little work to improve 7.10 bundle sizes. |
cchaos
left a comment
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.
👍 Thanks. Looks like my PR caused some conflicts though. Sorry 😆
wylieconlon
left a comment
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.
Tested locally and LGTM. I think the description is a little out of date now that it's a single bundle.
💚 Build SucceededMetrics [docs]@kbn/optimizer bundle module count
async chunks size
distributable file count
page load bundle size
History
To update your PR or re-run it, just comment with: |
This PR arranges a few imports to make the initial Lens bundle as small as possible. The current Lens bundle loads almost all of the code in the plugin and has >800kb. This PR brings this number down to 270kb (200kb of that being lodash which will be moved to shared bundles anyway: #78100 ).
The loading behavior in this PR is not optimal, but I think it's a good start and can be improved in subsequent PRs
This PR changes a few things:
expression.tsfile containing renderer and expression function, and avisualization.tsfile containing the visualization definition along with editor UI and so on.<name>_visualization.tsis the file being lazily imported, re-exporting bothvisualization.tsandexpression.ts.