Search code examples
javascriptangularangular-cli-v7

Angular: How to configure 'ng serve' command to open an Incognito Mode browser?


I want to open my project in an Incognito Mode browser so that no cache is stored.

Is there an Angular CLI flag that can be added to the ng serve -o command or to the Angular CLI configuration file that will support opening a browser in Incognito Mode?

I don't want to type my URL by opening the browser changing to incognito. I could disable cache and cookies, but I use youtube and other sites which would make for a reduced development experience.


Solution

  • Angular's CLI internally uses opn npm package when you pass that -o flag.

    Currently, the CLI doesn't support passing more options to the opn package, therefore it will open the site using your system's default browser.

    Feel free to file an issue in the CLI's repo - or even contribute to the project!

    Source: Angular CLI code (at the time of answer)