[chore] Tweak io-ts config on shared bundle#217202
Merged
dej611 merged 4 commits intoelastic:mainfrom Apr 9, 2025
Merged
Conversation
Contributor
💚 Build Succeeded
Metrics [docs]Module Count
Public APIs missing comments
Async chunks
Page load bundle
Unknown metric groupsAPI count
async chunk count
History
|
Contributor
|
Pinging @elastic/kibana-operations (Team:Operations) |
jbudz
approved these changes
Apr 8, 2025
Contributor
|
Starting backport for target branches: 8.x |
kibanamachine
pushed a commit
to kibanamachine/kibana
that referenced
this pull request
Apr 9, 2025
## Summary Save ~250kb out of thin air by tweaking the webpack configuration for the `io-ts` package. (cherry picked from commit 99d6c85)
Contributor
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
kibanamachine
added a commit
that referenced
this pull request
Apr 9, 2025
# Backport This will backport the following commits from `main` to `8.x`: - [[chore] Tweak io-ts config on shared bundle (#217202)](#217202) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Marco Liberati","email":"dej611@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-04-09T08:15:55Z","message":"[chore] Tweak io-ts config on shared bundle (#217202)\n\n## Summary\n\nSave ~250kb out of thin air by tweaking the webpack configuration for\nthe `io-ts` package.","sha":"99d6c85e027854555ac3acf07f1490241db71152","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Operations","release_note:skip","backport:version","v9.1.0","v8.19.0"],"title":"[chore] Tweak io-ts config on shared bundle","number":217202,"url":"https://github.com/elastic/kibana/pull/217202","mergeCommit":{"message":"[chore] Tweak io-ts config on shared bundle (#217202)\n\n## Summary\n\nSave ~250kb out of thin air by tweaking the webpack configuration for\nthe `io-ts` package.","sha":"99d6c85e027854555ac3acf07f1490241db71152"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/217202","number":217202,"mergeCommit":{"message":"[chore] Tweak io-ts config on shared bundle (#217202)\n\n## Summary\n\nSave ~250kb out of thin air by tweaking the webpack configuration for\nthe `io-ts` package.","sha":"99d6c85e027854555ac3acf07f1490241db71152"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Marco Liberati <dej611@users.noreply.github.com>
dej611
added a commit
that referenced
this pull request
Apr 17, 2025
## Summary After #217202 and #217034 this the another attempt with `lodash` and `lodash/fp`. In short: `lodash` and `lodash/fp` have a special webpack treatment as they are imported within the shared bundle. Now webpack is not smart enough to understand that `import camelCase from 'lodash/camelCase';` is still pointing to `lodash` and it thinks that `lodash/camelCase` is a different package, de-optimizing the bundling caching system. So I’ve tweaked the import to make it point to the shared bundle and save few kbs here and there
davismcphee
pushed a commit
to davismcphee/kibana
that referenced
this pull request
Apr 22, 2025
## Summary After elastic#217202 and elastic#217034 this the another attempt with `lodash` and `lodash/fp`. In short: `lodash` and `lodash/fp` have a special webpack treatment as they are imported within the shared bundle. Now webpack is not smart enough to understand that `import camelCase from 'lodash/camelCase';` is still pointing to `lodash` and it thinks that `lodash/camelCase` is a different package, de-optimizing the bundling caching system. So I’ve tweaked the import to make it point to the shared bundle and save few kbs here and there
dej611
added a commit
that referenced
this pull request
Apr 24, 2025
## Summary Similar to #217034, #217202 and #217467 this time applied to `react-use`. This is a slightly different approach than #217034 as we're caching here only the most common/frequently used methods from the `react-use` library and leaving the rest to be loaded within the specific plugin chunks. What this PR does it fundamentally: * adds `7.x kb` to the shared bundle * overall the startup bundle size shrinks about `3.5 kb` * the async bundle size shrinks of about `350 kb` (mainly due to 3 imports which were targeting `react-use/lib`). An alternative approach would be to just fix the async import strings in there, but I thought to it was worth it to make the long step here. Feedback appreciated.
akowalska622
pushed a commit
to akowalska622/kibana
that referenced
this pull request
May 29, 2025
## Summary After elastic#217202 and elastic#217034 this the another attempt with `lodash` and `lodash/fp`. In short: `lodash` and `lodash/fp` have a special webpack treatment as they are imported within the shared bundle. Now webpack is not smart enough to understand that `import camelCase from 'lodash/camelCase';` is still pointing to `lodash` and it thinks that `lodash/camelCase` is a different package, de-optimizing the bundling caching system. So I’ve tweaked the import to make it point to the shared bundle and save few kbs here and there
akowalska622
pushed a commit
to akowalska622/kibana
that referenced
this pull request
May 29, 2025
) ## Summary Similar to elastic#217034, elastic#217202 and elastic#217467 this time applied to `react-use`. This is a slightly different approach than elastic#217034 as we're caching here only the most common/frequently used methods from the `react-use` library and leaving the rest to be loaded within the specific plugin chunks. What this PR does it fundamentally: * adds `7.x kb` to the shared bundle * overall the startup bundle size shrinks about `3.5 kb` * the async bundle size shrinks of about `350 kb` (mainly due to 3 imports which were targeting `react-use/lib`). An alternative approach would be to just fix the async import strings in there, but I thought to it was worth it to make the long step here. Feedback appreciated.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Save ~250kb out of thin air by tweaking the webpack configuration for the
io-tspackage.