fix(core): update isDevMode to rely on ngDevMode#47475
fix(core): update isDevMode to rely on ngDevMode#47475alan-agius4 wants to merge 1 commit intoangular:mainfrom
isDevMode to rely on ngDevMode#47475Conversation
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). |
AndrewKushnir
left a comment
There was a problem hiding this comment.
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.
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.
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
isDevModeto rely on thengDevModewhich in the CLI is set by the bundler.We also update
@angular/platform-dynamic-browserand@angular/compilerto remove usage ofjitDevMode, which was the last internal usages ofisDevMode.