How-to: Use different environment variables for production and development with ionic 3

Create 2 configuration files with environment variables in folder src/config: config.dev.ts and config.prod.ts


Update: For Ionic < 3.7

Override 2 configuration files provided by @ionic/app-scripts package: optimization.config.js and webpack.config.js

Notify ionic to use these overridden files by adding links to them to package.json


Update: For Ionic >= 3.7

Override webpack.config.js, provided by @ionic/app-scripts package.

Notify ionic to use overridden file by adding link to package.json


Instruct TypeScript to use custom alias for a module by editing tsconfig.json

Finally, use your environment variables