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

[build] rewrite source as transpiled JS later in the process #73749

Merged
merged 2 commits into from
Jul 30, 2020

Conversation

spalger
Copy link
Contributor

@spalger spalger commented Jul 29, 2020

In the current build process we transpile JS source code with babel and replace the original source files with the babel output before running much of the build process. This causes webpack to receive CommonJS versions of code in common directories when it could be receiving ESM source that allows webpack to do some optimizations like module concatenation and module elimination.

Moving the babel transpilation after the BuildKibanaPlatformPlugins step allows the KP bundles to be built against the ESM version of source files. Those files are then converted to CommonJS in the next step of the build.

Doing this raised awareness of the fact that webpack ConcatenatedModules are really multiple modules for the same of the "module count" metric we're tracking, so I'm proposing that we start to add the number of modules which are being concatenated too. The module count being tracked is a proxy for the "build difficulty" of the bundle, and just because modules are shortened for faster execution in the browser doesn't change the fact that they're actually multiple files handled separately by the webpack loaders with their own work being done.

@spalger spalger added Team:Operations Team label for Operations Team v8.0.0 release_note:skip Skip the PR/issue when compiling release notes v7.10.0 labels Jul 29, 2020
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Build metrics

@kbn/optimizer bundle module count

id value diff baseline
advancedSettings 53 +30 23
alerts 25 +3 22
apm 941 +292 649
apmOss 6 +2 4
beats_management 307 +74 233
bfetch 20 +7 13
canvas 1318 +434 884
charts 268 +109 159
cloud 6 +2 4
console 159 +122 37
core 562 +128 434
crossClusterReplication 163 +103 60
dashboard 173 +59 114
dashboardEnhanced 28 +22 6
dashboardMode 7 +2 5
data 538 +276 262
dataEnhanced 18 +13 5
devTools 20 +3 17
discover 248 +136 112
discoverEnhanced 11 +9 2
embeddable 91 +51 40
embeddableEnhanced 10 +7 3
enterpriseSearch 166 +55 111
esUiShared 226 +49 177
expressions 108 +7 101
features 9 +3 6
fileUpload 28 +14 14
globalSearch 22 +6 16
globalSearchProviders 8 +5 3
graph 160 +64 96
grokdebugger 39 +28 11
home 207 +44 163
indexLifecycleManagement 178 +86 92
indexManagement 498 +323 175
indexPatternManagement 193 +145 48
infra 1054 +396 658
ingestManager 517 +154 363
ingestPipelines 368 +101 267
inputControlVis 44 +28 16
inspector 67 +18 49
kibanaLegacy 133 +38 95
kibanaReact 283 +38 245
kibanaUtils 190 +32 158
lens 253 +112 141
licenseManagement 145 +50 95
licensing 10 +2 8
lists 122 +21 101
logstash 195 +46 149
management 45 +20 25
maps 764 +340 424
mapsLegacy 140 +18 122
mapsLegacyLicensing 4 +2 2
ml 1224 +831 393
monitoring 615 +340 275
navigation 26 +7 19
newsfeed 10 +7 3
observability 95 +52 43
painlessLab 44 +26 18
regionMap 251 +93 158
remoteClusters 145 +79 66
reporting 44 +25 19
rollup 183 +114 69
savedObjects 48 +25 23
savedObjectsManagement 119 +46 73
searchprofiler 76 +47 29
security 453 +189 264
securitySolution 2033 +968 1065
share 38 +11 27
snapshotRestore 168 +135 33
spaces 192 +74 118
telemetry 23 +12 11
telemetryManagementSection 8 +4 4
tileMap 257 +97 160
timelion 105 +46 59
transform 318 +160 158
triggers_actions_ui 224 +73 151
uiActions 31 +11 20
uiActionsEnhanced 62 +34 28
upgradeAssistant 119 +35 84
uptime 502 +250 252
usageCollection 17 +14 3
visTypeMarkdown 256 +90 166
visTypeMetric 258 +92 166
visTypeTable 277 +106 171
visTypeTagcloud 261 +93 168
visTypeTimelion 280 +104 176
visTypeTimeseries 469 +142 327
visTypeVega 311 +114 197
visTypeVislib 507 +211 296
visTypeXy 4 +2 2
visualizations 134 +57 77
visualize 308 +107 201
watcher 227 +120 107
total - +9172 -

async chunks size

id value diff baseline
apm 3.7MB -7.9KB 3.7MB
canvas 1.5MB -6.0B 1.5MB
console 1.1MB -138.0B 1.1MB
discover 430.2KB -702.0B 430.9KB
graph 1.4MB -13.0B 1.4MB
home 510.9KB -12.0B 511.0KB
infra 3.6MB +56.0B 3.6MB
monitoring 1.1MB +62.0B 1.1MB
observability 311.8KB +20.0B 311.7KB
savedObjectsManagement 168.9KB +31.0B 168.9KB
securitySolution 7.3MB +41.0B 7.3MB
upgradeAssistant 323.2KB +40.0B 323.2KB
uptime 1.6MB +4.0KB 1.6MB
visTypeTimeseries 1.8MB -2.8KB 1.8MB
visualize 677.3KB +5.0B 677.3KB
watcher 603.9KB +4.1KB 599.8KB
total - -3.2KB -

page load bundle size

id value diff baseline
apmOss 3.9KB -301.0B 4.2KB
beats_management 580.6KB +24.0B 580.6KB
bfetch 26.2KB -1.8KB 28.0KB
canvas 1.4MB +16.0B 1.4MB
charts 873.8KB -251.0B 874.0KB
core 1.2MB +17.1KB 1.1MB
dashboard 678.1KB -1.7KB 679.8KB
data 1.4MB -39.0KB 1.4MB
esUiShared 987.3KB -22.2KB 1009.5KB
expressions 347.6KB +3.7KB 343.8KB
home 24.0KB -1.9KB 25.9KB
inspector 278.4KB -782.0B 279.2KB
kibanaLegacy 247.2KB +46.0B 247.2KB
kibanaUtils 467.9KB -1.5KB 469.4KB
lens 841.0KB +16.0B 841.0KB
ml 4.3MB +16.0B 4.3MB
newsfeed 21.8KB -871.0B 22.7KB
savedObjects 237.3KB -357.0B 237.7KB
savedObjectsManagement 216.4KB -570.0B 217.0KB
share 80.0KB -1000.0B 81.0KB
telemetry 73.9KB -2.0KB 75.9KB
upgradeAssistant 56.9KB +5.0KB 51.9KB
visTypeTimelion 711.8KB -1.1KB 712.9KB
visTypeTimeseries 280.3KB -274.0B 280.6KB
visTypeVislib 1.3MB -345.0B 1.3MB
visualizations 408.3KB -263.0B 408.6KB
total - -50.0KB -

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@spalger spalger marked this pull request as ready for review July 30, 2020 00:18
@spalger spalger requested a review from a team as a code owner July 30, 2020 00:18
@elasticmachine
Copy link
Contributor

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

@spalger
Copy link
Contributor Author

spalger commented Jul 30, 2020

Note to reviewers, the page load bundle size is reduced by 50kb because webpack can now use concatenated modules for more code, and the @kbn/optimizer bundle module count has increased dramatically because modules combined using concatenated modules are now being counted when they were previously being ignored.

@spalger spalger changed the title [build] rewrite source as tranpiled JS later in the process [build] rewrite source as transpiled JS later in the process Jul 30, 2020
Copy link
Member

@mistic mistic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@spalger spalger merged commit 6bfd4e6 into elastic:master Jul 30, 2020
@spalger spalger deleted the implement/transpile-babel-later branch July 30, 2020 00:53
spalger added a commit to spalger/kibana that referenced this pull request Jul 30, 2020
spalger added a commit that referenced this pull request Jul 30, 2020
gmmorris added a commit to gmmorris/kibana that referenced this pull request Jul 30, 2020
* master:
  [Vega][Inspector] Request panel should show correct names for requests (elastic#73655)
  [Security Solution] Update filter (elastic#73350)
  TSVB Inaccurate Group By (elastic#73683)
  [Vega][Inspect panel] Write tutorials and reference (elastic#73262)
  [ML] Removing node info check for file data viz import (elastic#73717)
  check that pathname has been updated. ignore other parts (elastic#73689)
  [build] rewrite source as transpiled JS later in the process (elastic#73749)
  Fix Snapshot Restore /policies/indices API endpoint on Cloud (elastic#73734)
  skip flaky suite (elastic#69783) (elastic#70043)
  [Security Solution][Exceptions] - Updates exception hooks and viewer (elastic#73588)
  skip failing suite (elastic#58815)
  [Canvas][fatal bug] Fix props confusion in TextStylePicker (elastic#73732)
  [DOCS] Changes level offset of monitoring pages (elastic#73573)
  Added close button to toast notifications by migrating to different API that is more widely used in Kibana and Security solution in particular. (elastic#73662)
  [ML] Transforms/DFA: Change action button size back to 'xs'.
  [Metrics UI] Fix evaluating rate-aggregated alerts when there's no normalized value (elastic#73545)
  [Metrics UI] Fix formatting of values in inventory context.reason (elastic#73155)
  [maps] rename GisMap to MapContainer and convert to TS (elastic#73690)
  [APM] docs: remove watcher documentation  (elastic#73485)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:skip Skip the PR/issue when compiling release notes Team:Operations Team label for Operations Team v7.10.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants