-
Notifications
You must be signed in to change notification settings - Fork 12k
feat(@angular-devkit/build-optimizer): don't use getImportTslibTransformer #15749
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
I saw the mentioned size regression in angular/angular#32957, debugged it and found the following: We have the importTsLib transformer in BO that converts inlined ts declarations into tslib imports. We have a regex test that's meant to bypass the transformer to speed things up. When you don't have sourcemaps turned on, we don't use the regex test. When you make a build with sourcemaps, the regex fails to find the zone.js inlined tslib, and does nothing. When you make a build without sourcemaps, the regex isn't used, and the more sophisticated AST based test is used instead, which converts the zone.js tslib function into an import. Adding an import to zone.js introduces a cross-chunk dependency between polyfills and main, because both use tslib. This prevents tslib from being concatenated with the rest of polyfills and of main, which in turn prevents further optimizations. |
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, other than adding the deprecated msg in the transformer.
Also, you can probably remove the testImportTslib
method.
ba1a602
to
720ee0c
Compare
720ee0c
to
81e659d
Compare
packages/angular_devkit/build_optimizer/src/transforms/import-tslib.ts
Outdated
Show resolved
Hide resolved
…ormer This transformer can cause size regressions when it introduces `tslib` imports across independent chunks. It should be deprecated because tslib adoption has become more ubiquitous. Should also speed up Build Optimizer processing time because there's one less thing to do. Closes angular#15401 without adding the warning, because some libraries like zone.js should inline the helpers.
81e659d
to
7147412
Compare
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
This transformer can cause size regressions when it introduces
tslib
imports across independent chunks.It should be deprecated because tslib adoption has become more ubiquitous.
Should also speed up Build Optimizer processing time because there's one less thing to do.