How to include code for a debug build?

See: https://github.com/ionic-team/ionic-app-scripts

IONIC_ENV	Value can be either prod or dev.

For example:

const env = process.env.IONIC_ENV;

if (env === 'prod') {
  ...
}

See: https://robferguson.org/blog/2017/09/09/a-simple-logging-service-for-angular-4/