-
Notifications
You must be signed in to change notification settings - Fork 26.2k
fix(core): use shakeable global definitions #29929
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
You can preview bb7b732 at https://pr29929-bb7b732.ngbuilds.io/. |
The `ngDevMode` and `ngI18nClosureMode` are special in that they should be set to `false` on production builds in order to shake out code associated with it. Angular CLI does this in https://github.com/angular/angular-cli/blob/5fc1f2499cbe57f9a95e4b0dfced130eb3a8046d/packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/common.ts#L279-L282. But in #28689 the toplevel usage was changed from `ngDevMode` to `global['ngDevMode']` (and the same for `ngI18nClosureMode`). This indirection prevents the static analysis in Terser from effecting the replacement.
You can preview b44260f at https://pr29929-b44260f.ngbuilds.io/. |
You can preview c194b32 at https://pr29929-c194b32.ngbuilds.io/. |
The `ngDevMode` and `ngI18nClosureMode` are special in that they should be set to `false` on production builds in order to shake out code associated with it. Angular CLI does this in https://github.com/angular/angular-cli/blob/5fc1f2499cbe57f9a95e4b0dfced130eb3a8046d/packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/common.ts#L279-L282. But in angular#28689 the toplevel usage was changed from `ngDevMode` to `global['ngDevMode']` (and the same for `ngI18nClosureMode`). This indirection prevents the static analysis in Terser from effecting the replacement. PR Close angular#29929
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. |
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
The
ngDevMode
andngI18nClosureMode
are special in that they should be set tofalse
on production builds in order to shake out code associated with it.Angular CLI does this in https://github.com/angular/angular-cli/blob/5fc1f2499cbe57f9a95e4b0dfced130eb3a8046d/packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/common.ts#L279-L282.
But in #28689 the toplevel usage was changed from
ngDevMode
toglobal['ngDevMode']
(and the same forngI18nClosureMode
). This indirection prevents the static analysis in Terser from effecting the replacement.What is the new behavior?
The variables that should be defined globally are synced between Angular core and CLI.
Does this PR introduce a breaking change?
Other information