X Tutup
The Wayback Machine - https://web.archive.org/web/20200628001033/https://github.com/angular/angular/issues/37644
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

mark `enableProdMode` as deprecated and output a warning that it should not be used anymore #37644

Open
sod opened this issue Jun 19, 2020 · 1 comment

Comments

@sod
Copy link
Contributor

@sod sod commented Jun 19, 2020

angular 9.1.9

enableProdMode() right now is a placebo. The only thing it does is removing the app is running in dev mode warning to the console. So if you forgot to disable it at build time but rely on enableProdMode() to be working, your app runs in dev mode with a rather big performance hit.

You could print a warning, that enableProdMode() is deprecated and won't work and that dev mode can only be disabled at build time (or do (window as any).ngDevMode = false; as workaround). Or restore its functionality, if this is not intended.

Reproduction: https://angular-ivy-bjsurx.stackblitz.io/ | see main.ts, enableProdMode() is called
Open devtools and set a breakpoint anywhere where ngDevMode is used, and observe it not being falsy. Or look at the DOM and see debug attributes & comments.

image

image

@sod
Copy link
Contributor Author

@sod sod commented Jun 19, 2020

Seems like it's not totally noop. It's used frequently throughout angular. Only the new ivy dev mode https://github.com/angular/angular/blob/d1ea1f4c7f3358b730b0d94e65b00bc28cae279c/packages/core/src/util/ng_dev_mode.ts is being ignored.

Just wondered as the documentation says, that it turns off assertions and other checks, but those assertions are behind the ngDevMode variable as seen in the first screenshot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.
X Tutup