-
-
Notifications
You must be signed in to change notification settings - Fork 112
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
feat(web): downcompile helper treeshaking 🧩 #8964
feat(web): downcompile helper treeshaking 🧩 #8964
Conversation
…inalizes coverage
User Test ResultsTest specification and instructions User tests are not required Test Artifacts
|
Report from my local build with the current state of this PR:
Compared against #8904:
|
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.
LGTM. I wonder if this is something we could submit upstream to esbuild or typescript/tslib maintainers? It may be that they would be willing to take this on since it is a nice perf optimization for many common build chains
I've linked this and its predecessor to the most relevant For |
From #8904:
esbuild
isn't able to figure it out on its own, as we're having it bundle ES5 JS files that result from our TS compilation, so we have to help it along. We can utilizeesbuild
's plugin feature as an "in" to perform treeshaking oftslib
's importable helper definitions.I might have invested a bit much into it, given the limited savings this affords us, but I've aimed to make the treeshaker reasonably maintainable.
tslib
versions and new helpers get added, build warnings will be logged about potential, as-of-yet-unverified helpers that could be added to the treeshaking detection system.These reports are integrated within
esbuild
's output logs by use of the proper plugin return types & message forwarding. It'll even highlight the helper and its location within the main tslib.js file that's presenting a problem within the logged message, which gets hyperlinked in build logs (when viewed within VS Code's terminal, at least).This saves us maybe another 8.5 KB in total after #8904; it's not that much, but it is something, at least. (That is over 33% of the increase noted by the
check/web/filesize
check reported for #8904.) And this optimization work was absolutely necessary fortslib
to save us anything at all within the lm-worker due to its comparatively minimal use of downcompile-helpers.@keymanapp-test-bot skip