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

Closed
sod opened this issue Jun 19, 2020 · 3 comments
Labels
area: core Issues related to the framework runtime core: bootstrap core: debug tools P2 The issue is important to a large percentage of users, with a workaround
Milestone

Comments

@sod
Copy link
Contributor

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

@pkozlowski-opensource pkozlowski-opensource added area: core Issues related to the framework runtime core: debug tools labels Jun 19, 2020
@ngbot ngbot bot modified the milestone: needsTriage Jun 19, 2020
@sod
Copy link
Contributor Author

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.

@AndrewKushnir AndrewKushnir added the P2 The issue is important to a large percentage of users, with a workaround label Oct 28, 2020
@ngbot ngbot bot modified the milestones: needsTriage, Backlog Oct 28, 2020
@sod
Copy link
Contributor Author

sod commented Dec 18, 2020

closed by #40124

@sod sod closed this as completed Jan 8, 2021
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Feb 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: core Issues related to the framework runtime core: bootstrap core: debug tools P2 The issue is important to a large percentage of users, with a workaround
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants