Home > other >  Google chrome console is not showing correct, accurate javascript line number
Google chrome console is not showing correct, accurate javascript line number

Time:10-13

I am working on an angular project with ionic framework, using ion-router-outlet all that, and trying to debug with google chrome console. But, google chrome console is not showing correct line number and is almost impossible to debug with.

enter image description here

As you can see, all error now points to main.js:1:anyline. I missed the old time where there are actual accurate bug indicator. How do I fix this issue? Thank you.

Additional information. This is how the source window looks like. enter image description here

Also there are this error message after I add break point to the formatted.main.js enter image description here

CodePudding user response:

I have fixed the bug. Aside from suggestion in comment above such as google chrome console enable "source map option". Remember to correctly format the angular.json file For example ,I put the options inside production configuration like this

"configurations": {
  "production": {
     "fileReplacements": [{
       "replace": "src/environments/environment.ts",
        "with": "src/environments/environment.prod.ts"
      }]
   },
   "optimization": false,
   "sourceMap": true,
   "namedChunks": true,
   "extractLicenses": false,
   "vendorChunk": false,
   "buildOptimizer": false
}

And so my ng serve command will never make source map. I shall try something like serve it in production mode with ng serve --configuration production. Or simply put it inside options, outside of production layer

Sorry didn't gave enough source code, thought my mistake is much more complicated.

  • Related