Skip to content

[chore] Bundle fp-ts into the shared bundle#217034

Merged
dej611 merged 18 commits intoelastic:mainfrom
dej611:chore/fp-ts-dep
Apr 16, 2025
Merged

[chore] Bundle fp-ts into the shared bundle#217034
dej611 merged 18 commits intoelastic:mainfrom
dej611:chore/fp-ts-dep

Conversation

@dej611
Copy link
Copy Markdown
Contributor

@dej611 dej611 commented Apr 3, 2025

Summary

Just had some fun and made fp-ts available in the shared bundle, with support for partial imports.

Changes in this PR:

  • aligned fp-ts direct imports to the format: fp-ts/<module>
  • Mapped the direct imports into the shared bundle re-using the same fp-ts module under the hood

@dej611 dej611 changed the title [Chore] Bundle fp-ts into the shared bundle [chore] Bundle fp-ts into the shared bundle Apr 3, 2025
@dej611 dej611 added Team:Operations Kibana-Operations Team release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting labels Apr 8, 2025
@dej611 dej611 marked this pull request as ready for review April 8, 2025 07:00
@dej611 dej611 requested a review from a team as a code owner April 8, 2025 07:00
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-operations (Team:Operations)

@dej611 dej611 requested review from a team as code owners April 8, 2025 07:00
@dej611 dej611 requested a review from a team April 8, 2025 07:00
@dej611 dej611 requested review from a team as code owners April 8, 2025 07:00
@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
aiAssistantManagementSelection 64 60 -4
apm 1890 1885 -5
cases 1000 996 -4
cloudSecurityPosture 700 699 -1
console 218 217 -1
dataQuality 68 64 -4
datasetQuality 306 302 -4
discover 1208 1205 -3
esqlDataGrid 421 420 -1
eventAnnotationListing 593 592 -1
exploratoryView 164 161 -3
fieldsMetadata 49 45 -4
indexManagement 671 663 -8
infra 1433 1428 -5
ingestPipelines 345 337 -8
inventory 234 230 -4
lens 1366 1365 -1
lists 422 412 -10
logsShared 345 341 -4
metricsDataAccess 246 242 -4
ml 2385 2382 -3
monitoring 635 632 -3
observability 1295 1289 -6
observabilityAIAssistantApp 440 436 -4
observabilityAiAssistantManagement 387 383 -4
observabilityShared 208 204 -4
profiling 290 286 -4
searchprofiler 72 71 -1
securitySolution 7244 7234 -10
slo 1122 1117 -5
stackConnectors 329 319 -10
streamsApp 442 438 -4
synthetics 1197 1187 -10
transform 705 702 -3
triggersActionsUi 749 743 -6
upgradeAssistant 194 190 -4
uptime 790 780 -10
ux 180 176 -4
total -174

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/ui-shared-deps-src 58 67 +9

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
aiAssistantManagementSelection 73.0KB 61.9KB -11.1KB
apm 2.6MB 2.5MB -28.2KB
cloudSecurityPosture 525.3KB 524.3KB -1021.0B
console 186.4KB 186.3KB -52.0B
dataQuality 19.6KB 8.5KB -11.1KB
datasetQuality 241.0KB 233.9KB -7.1KB
discover 970.7KB 957.8KB -13.0KB
esqlDataGrid 159.1KB 158.1KB -1008.0B
exploratoryView 153.1KB 142.0KB -11.1KB
fieldsMetadata 65.6KB 54.4KB -11.2KB
indexManagement 708.5KB 687.9KB -20.5KB
infra 1.2MB 1.2MB -22.1KB
ingestPipelines 402.2KB 359.4KB -42.8KB
inventory 191.9KB 180.7KB -11.2KB
lens 1.4MB 1.4MB -1021.0B
lists 137.4KB 108.7KB -28.8KB
ml 5.3MB 5.3MB -10.1KB
monitoring 633.9KB 623.7KB -10.1KB
observability 1.3MB 1.3MB -18.8KB
observabilityAIAssistantApp 251.2KB 240.1KB -11.1KB
observabilityAiAssistantManagement 92.0KB 80.9KB -11.1KB
profiling 383.9KB 372.7KB -11.1KB
searchprofiler 43.6KB 43.0KB -676.0B
securitySolution 9.0MB 9.0MB -28.7KB
slo 917.7KB 910.4KB -7.3KB
stackConnectors 618.1KB 607.0KB -11.1KB
streamsApp 407.7KB 396.6KB -11.1KB
synthetics 959.4KB 952.1KB -7.3KB
transform 629.2KB 619.1KB -10.1KB
triggersActionsUi 1.4MB 1.4MB -21.8KB
upgradeAssistant 207.8KB 207.8KB +16.0B
uptime 503.7KB 496.4KB -7.3KB
ux 149.6KB 138.5KB -11.1KB
total -410.1KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
aiAssistantManagementSelection 5.3KB 5.4KB +62.0B
apm 35.1KB 35.2KB +141.0B
cases 144.0KB 133.0KB -11.0KB
cloudSecurityPosture 17.4KB 17.4KB +64.0B
console 26.0KB 26.1KB +62.0B
dataQuality 9.0KB 9.2KB +190.0B
datasetQuality 20.1KB 20.2KB +144.0B
discover 20.4KB 20.6KB +192.0B
esqlDataGrid 9.8KB 9.9KB +64.0B
exploratoryView 41.8KB 41.9KB +63.0B
fieldsMetadata 5.0KB 5.2KB +190.0B
indexManagement 31.4KB 31.5KB +168.0B
infra 49.5KB 49.7KB +168.0B
ingestPipelines 15.6KB 15.8KB +189.0B
inventory 13.5KB 13.7KB +192.0B
kbnUiSharedDeps-npmDll 6.1MB 6.2MB +145.2KB
kbnUiSharedDeps-srcJs 3.6MB 3.6MB +64.0B
lens 57.6KB 57.7KB +64.0B
lists 4.3KB 4.5KB +241.0B
logsShared 130.8KB 119.7KB -11.0KB
ml 85.2KB 85.3KB +130.0B
monitoring 25.4KB 25.5KB +128.0B
observability 94.5KB 94.7KB +159.0B
observabilityAIAssistantApp 15.8KB 15.8KB +63.0B
observabilityAiAssistantManagement 5.8KB 5.9KB +62.0B
observabilityShared 86.6KB 75.5KB -11.1KB
profiling 18.3KB 18.3KB +63.0B
searchprofiler 16.4KB 16.5KB +64.0B
securitySolution 89.2KB 89.4KB +262.0B
slo 42.5KB 31.6KB -10.9KB
stackConnectors 60.0KB 60.2KB +192.0B
streamsApp 9.7KB 9.7KB +63.0B
synthetics 38.0KB 27.1KB -10.9KB
transform 19.6KB 19.8KB +128.0B
triggersActionsUi 99.7KB 99.8KB +101.0B
upgradeAssistant 23.8KB 23.9KB +128.0B
uptime 53.5KB 42.6KB -10.9KB
ux 7.2KB 7.3KB +63.0B
total +83.2KB
Unknown metric groups

API count

id before after diff
@kbn/ui-shared-deps-src 67 76 +9

async chunk count

id before after diff
datasetQuality 13 12 -1
infra 31 30 -1
observability 25 24 -1
triggersActionsUi 55 54 -1
total -4

History

@dej611 dej611 merged commit 0a6bc1b into elastic:main Apr 16, 2025
10 checks passed
akowalska622 pushed a commit to akowalska622/kibana that referenced this pull request Apr 17, 2025
## Summary

Just had some fun and made fp-ts available in the shared bundle, with
support for partial imports.

Changes in this PR:
* aligned `fp-ts` direct imports to the format: `fp-ts/<module>`
* Mapped the direct imports into the shared bundle re-using the same
`fp-ts` module under the hood
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 23, 2025
## Summary

This PR is the counter part of
#217034 to avoid making the same
mistake again in the future.
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.
@dej611 dej611 self-assigned this Apr 28, 2025
akowalska622 pushed a commit to akowalska622/kibana that referenced this pull request May 29, 2025
## Summary

Just had some fun and made fp-ts available in the shared bundle, with
support for partial imports.

Changes in this PR:
* aligned `fp-ts` direct imports to the format: `fp-ts/<module>`
* Mapped the direct imports into the shared bundle re-using the same
`fp-ts` module under the hood
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

This PR is the counter part of
elastic#217034 to avoid making the same
mistake again in the future.
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.
@dej611
Copy link
Copy Markdown
Contributor Author

dej611 commented Jun 26, 2025

💚 All backports created successfully

Status Branch Result
8.19

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

dej611 added a commit to dej611/kibana that referenced this pull request Jun 26, 2025
## Summary

Just had some fun and made fp-ts available in the shared bundle, with
support for partial imports.

Changes in this PR:
* aligned `fp-ts` direct imports to the format: `fp-ts/<module>`
* Mapped the direct imports into the shared bundle re-using the same
`fp-ts` module under the hood

(cherry picked from commit 0a6bc1b)

# Conflicts:
#	src/core/packages/saved-objects/migration-server-internal/src/actions/bulk_overwrite_transformed_documents.ts
#	src/core/packages/saved-objects/migration-server-internal/src/actions/create_index.ts
#	src/core/packages/saved-objects/migration-server-internal/src/actions/read_with_pit.ts
#	src/core/packages/saved-objects/migration-server-internal/src/actions/wait_for_task.ts
#	x-pack/solutions/observability/plugins/inventory/common/rt_types.ts
#	x-pack/solutions/security/plugins/security_solution/server/lib/timeline/saved_object/pinned_events/index.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting ci:build-webpack-bundle-analyzer release_note:skip Skip the PR/issue when compiling release notes Team:actionable-obs Formerly "obs-ux-management", responsible for SLO, o11y alerting, significant events, & synthetics. Team:obs-ux-infra_services - DEPRECATED DEPRECATED - Use Team:obs-presentation. Team:Operations Kibana-Operations Team v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.