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

fix(core): use shakeable global definitions #29929

Closed
wants to merge 2 commits into from

Conversation

Projects
None yet
6 participants
@filipesilva
Copy link
Member

commented Apr 16, 2019

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.io application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

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.

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?

  • Yes
  • No

Other information

@filipesilva filipesilva requested a review from angular/fw-core as a code owner Apr 16, 2019

@googlebot googlebot added the cla: yes label Apr 16, 2019

@filipesilva filipesilva requested review from ocombe and mhevery Apr 16, 2019

@mary-poppins

This comment has been minimized.

Copy link

commented Apr 16, 2019

fix(core): use shakeable global definitions
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.

@filipesilva filipesilva force-pushed the filipesilva:fix-globaldefs branch from bb7b732 to b44260f Apr 16, 2019

@mary-poppins

This comment has been minimized.

Copy link

commented Apr 16, 2019

@filipesilva filipesilva requested review from angular/fw-compiler as code owners Apr 17, 2019

@mary-poppins

This comment has been minimized.

Copy link

commented Apr 17, 2019

@filipesilva filipesilva requested review from vikerman and removed request for mhevery and ocombe Apr 17, 2019

@ngbot ngbot bot added this to the needsTriage milestone Apr 17, 2019

@benlesh

This comment has been minimized.

Copy link
Contributor

commented Apr 17, 2019

@benlesh benlesh closed this in e5905bb Apr 18, 2019

benlesh added a commit that referenced this pull request Apr 18, 2019

@filipesilva filipesilva deleted the filipesilva:fix-globaldefs branch Apr 18, 2019

filipesilva added a commit to filipesilva/angular-cli that referenced this pull request Apr 24, 2019

filipesilva added a commit to filipesilva/angular-cli that referenced this pull request Apr 24, 2019

filipesilva added a commit to filipesilva/angular-cli that referenced this pull request Apr 24, 2019

alexeagle added a commit to angular/angular-cli that referenced this pull request Apr 24, 2019

BioPhoton added a commit to BioPhoton/angular that referenced this pull request May 21, 2019

fix(core): use shakeable global definitions (angular#29929)
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

BioPhoton added a commit to BioPhoton/angular that referenced this pull request May 21, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.