How to recognize at runtime that app was built with -prod


#1

Is there a way to recognize in the running app that it was built with/without -prod flag?

 ionic build --prod 

$ ionic info

cli packages: (/usr/local/lib/node_modules)

@ionic/cli-utils  : 1.15.2
ionic (Ionic CLI) : 3.15.2

global packages:

cordova (Cordova CLI) : 7.0.1

local packages:

@ionic/app-scripts : 3.0.1
Cordova Platforms  : ios 4.4.0
Ionic Framework    : ionic-angular 3.8.0

System:

Android SDK Tools : 26.1.1
ios-deploy        : 1.9.2
ios-sim           : 5.0.8
Node              : v6.9.1
npm               : 5.4.2
OS                : macOS Sierra
Xcode             : Xcode 9.0.1 Build version 9A1004

Environment Variables:

ANDROID_HOME : /Users/uzimskacel/Library/Android/sdk

Misc:

backend : pro

#2

I use the following

import { isDevMode } from '@angular/core';

...
export class AppComponent { 
  constructor() {
    console.log(isDevMode());
  }
}



https://www.williamghelfi.com/blog/2017/06/22/ionic-environments-webpack/