21.01.2020
2 min read
Codezeilen auf einem Computerbildschirm, die eine Webseite in HTML und CSS darstellen.

Disabling Prod Mode in an Already Built Angular App in Chrome

  • dev
Short summary:

This might be well known, but I just discovered it today and wanted to share it for beginners or those not using this great feature of Chrome DevTools for debugging.

This might be well known, but I just discovered it today and wanted to share it for beginners or those not using this great feature of Chrome DevTools for debugging.

Since Chrome version 65 — and yes, I know this version was released back in early 2018 — there’s a tab called “Overrides” in the DevTools Sources section that lets you replace files normally requested from the server with local files.

To use this, just open your DevTools, go to Sources, click on “Overrides,” and select a folder for overrides.

After that, you can return to Sources, right-click on a file, and save it for overrides.

Chrome will then create a folder in your selected override folder named after the page you saved the file from, containing all files you save for this domain.

From here, you can make changes using DevTools or any editor you prefer.

For example, we can take any main JS file generated after Angular's build process and search for “enableProdMode” to ultimately remove that line of code and get “ng.probe” back even after reloads.