- First we need to install a couple of packages:
npm install --save-dev webpack-merge npm install --save-dev cross-env npm install --save deepmerge
- Create config directory
config/
- Put this file
webpack.config.js
inside that directory - Make a directory for your environment files
src/environments/
- Put my sample environment files in it
- Now we need to make Ionic know about your custom webpack config file. Open
package.json
. If you don't have a"config"
section add the following line:If you do have an existing config section, add that specific line to it"config": { "ionic_webpack": "./config/webpack.config.js" },
- Also in the
package.json
file, add some script aliases. These are easier to type commands to build with your custom configs than typing them out each time. For my sample config files, add these to the end of the"scripts"
block:"cordova:build:dev": "cross-env NODE_ENV=dev ionic cordova build ios", "cordova:build:uat": "cross-env NODE_ENV=uat ionic cordova build ios", "cordova:build:prod": "cross-env NODE_ENV=prod ionic cordova build ios --prod", "ionic:serve:dev": "NODE_ENV=dev npm run ionic:serve", "ionic:serve:uat": "NODE_ENV=uat npm run ionic:serve", "ionic:serve:prod": "NODE_ENV=prod npm run ionic:serve",
- All done, you're ready to go!
This repository has been archived by the owner on Dec 17, 2021. It is now read-only.