How to debug angular in prod server?

In the development environment, I can debug the Chrome source tab, but on the prod server I use the contents of the dist folder after running ng build --prod . This folder contains compiled code, so if there is a problem in production, I don’t know how to debug to find the problem.

Is it possible to debug production compiled code?

+17
source share
3 answers

Update: you can try ng build --prod --sourcemap

For previous versions of angular-2 this will work, ng build --prod --sourcemap

+18
source

In Angualr CLI 6, the parameters seem to have changed

 ng build --prod --source-map 

Or you can enable source maps in angular.json by setting sourceMap: true in production configurations

 "configurations": { "production": { "optimization": true, "outputHashing": "all", **"sourceMap": false,** -------- 
+4
source

If you are deploying to a test server, do not use --prod, so if an error occurs, you will see full error information, but your application will work in development mode.

0
source

Source: https://habr.com/ru/post/1271060/


All Articles