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): update isDevMode
to rely on ngDevMode
#47475
Conversation
9ae7ac7
to
ee3c428
Compare
ee3c428
to
b0b9a6f
Compare
We've discussed this on the fwk side in the past and I believe that this would be breaking change. Adding a label accordingly. |
@pkozlowski-opensource why would this be a breaking change? Calling |
b0b9a6f
to
94e273e
Compare
@alan-agius4 the framework does not, but the existing libraries might (and probably do). |
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 👍
It'd be great to add some additional docs for the isDevMode
and enableProdMode
functions to explain where the value is coming from and what'd be the best way to change it (via CLI flags vs enabling at runtime).
489dca2
to
f352341
Compare
This commits update `isDevMode` to rely on the `ngDevMode` which in the CLI is set by the bundler. We also update `@angular/platform-dynamic-browser` and `@angular/compiler` to remove usage of `jitDevMode`, with this change we remove all internal usages of `isDevMode`.
f352341
to
137d04a
Compare
This PR was merged into the repository by commit 85330f3. |
This commits update `isDevMode` to rely on the `ngDevMode` which in the CLI is set by the bundler. We also update `@angular/platform-dynamic-browser` and `@angular/compiler` to remove usage of `jitDevMode`, with this change we remove all internal usages of `isDevMode`. PR Close angular#47475
export function isDevMode(): boolean { | ||
_runModeLocked = true; | ||
return _devMode; | ||
return typeof ngDevMode === 'undefined' || !!ngDevMode; | ||
} |
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.
Hi @alan-agius4. I have a question, so to better understand:
Now isDevMode()
explicitly depends on ngDevMode
. Does it by any chance help to tree-shake code in custom applications, that is conditionally wrapped with isDevMode
()? e.g.
if(isDevMode()){
console.error('Some very long string message in custom app....');
}
If not, would it help to expose ngDevMode
in Angular public API, so it could be used it in custom applications?
if(ngDevMode){
console.error('Some very long string message in custom app....');
}
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.
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.
Indeed this does not aid tree-shaking.
ngDevMode
is still considered as a private API, but we do have a project to make this available as a public API.
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 commits update
isDevMode
to rely on thengDevMode
which in the CLI is set by the bundler.We also update
@angular/platform-dynamic-browser
and@angular/compiler
to remove usage ofjitDevMode
, which was the last internal usages ofisDevMode
.