A way of using custom command line parameters in builds?

Hi all,

is there a way to pass command line parameters to ionic serve or ionic build?
In my case I have the following setup:

  • In package.json I have the following script
    "build": ionic build

and i want to pass in parameters that I can use in my custom rollup config for example.
Example for planned usage from command line:

npm run build --stage=prod

Any help would be greatly appreciated!

2 Likes

you can put a command as below,

ionic cordova build android --prod --alphaTest

which you can get from hooks such as build-before.js

module.exports = function(ctx) {
console.log(ctx.argv);
}

more information @