I have a pesky error that occurs only in the production environment. But, Angular minifies and uglifies the production build. Is there any way to create an otherwise entirely production build, but without the hard to troubleshoot code?
How to disable minifying and uglifying/obfuscation in the production build of an Angular project?
Asked Answered
From the Angular Docs it looks like you should be able to disable the optimizations by passing in a simple flag. Something like:
ng build --configuration production --optimization=false
An alternative approach would be to go into your angular.json file and update your configurations to "optimization": false
. Although I suspect you're wanting to do this to help debug some code. In which case the flag is probably the more convenient solution.
The command --prod is deprecated since Angular 12 and removed in Angular 14. Use:
ng build --configuration production --optimization=false
if ng build --prod --optimization=false
doesn't work.
© 2022 - 2024 — McMap. All rights reserved.