In Ionic 4, how can I determine if I'm in dev or prod?

In Ionic 3, I could use this code to check if I was running on a device or in a browser:

if ((<any>window).cordova)
        this.debug = false;

The if ((<any>window).cordova) always returns false in Ionic 4.

How can I check if I’m in debug mode?

Check the current Platform

This doesn’t work.

If I’m testing on Chrome as iPhone, using"ios") returns true.

I was hoping to be able to use angular environments, but it appears that the Ionic Pro build doesn’t use ng build --prod. Just ng build. So environment never gets switched to prod.

maybe for chrome on ios

 if ("ios") && !"cordova")) {}

about build environment maybe the chapter “Build environments” could give a hint

Thanks! Those links did lead me to the right solution.

Basically, the Ionic Pro build will use whatever is in your package.json. Mine had this:

	"scripts": {
		"build": "ng build"

I changed it to this:

	"scripts": {
		"build": "ng build --prod",

Which gave me the correct environment variable.