CLI v3 custom flags not passed to command

After upgrading ionic from 2.0.0-rc-5 to 3.6.0 my custom rollup config has stop receiving my custom flag when i build to a platform. It does works for ionic serve and ionic build command.

before v2.0.0-rc5 (worked)

ionic build ios --production

after (v3.6.0)

ionic build --production
# console logs
Running app-scripts build: --production

ionic cordova build ios --production
# console logs
Running app-scripts build: --address 0.0.0.0 --port 8100 --p 8100 --livereload-port 35729 --r 35729 --iscordovaserve --nobrowser

Did you upgrade Ionic (Framework, ionic-angular) or Ionic CLI?

I think the CLI has a “whitelist” of commands for ionic cordova build or something…

i updated both the cli and ionic-angular

Jsut for my understanding: How do you handle and what do you do with this flag? (I am not accustomed with rollup)

i use the flag to change the app’s environment variables.

var nodeResolve = require('rollup-plugin-node-resolve');
var commonjs = require('rollup-plugin-commonjs');
var globals = require('rollup-plugin-node-globals');
var builtins = require('rollup-plugin-node-builtins');
var json = require('rollup-plugin-json');
var replace = require('rollup-plugin-replace');
var argv = require('yargs').argv;
var isProd = false;
if(argv.production){
  console.log('=====> configuring for production');
  isProd = true;
}

// https://github.com/rollup/rollup/wiki/JavaScript-API

var rollupConfig = {
  /**
   * entry: The bundle's starting point. This file will
   * be included, along with the minimum necessary code
   * from its dependencies
   */
  entry: process.env.IONIC_APP_ENTRY_POINT,

  /**
   * sourceMap: If true, a separate sourcemap file will
   * be created.
   */
  sourceMap: process.env.IONIC_GENERATE_SOURCE_MAP ? true : false,

  /**
   * format: The format of the generated bundle
   */
  format: 'iife',

  /**
   * dest: the output filename for the bundle in the buildDir
   */
  dest: process.env.IONIC_OUTPUT_JS_FILE_NAME,

  /**
   * plugins: Array of plugin objects, or a single plugin object.
   * See https://github.com/rollup/rollup/wiki/Plugins for more info.
   */
  plugins: [
    replace({
        exclude: 'node_modules/**',
        // use the /config/environment-dev as the default import(!), no stub needed.
        // note we only replace the "last" part of the import statement so relative paths are maintained
        '/config/env.dev' : ( isProd ? '/config/env.prod' : '/config/env.dev'),
    }),
    builtins(),
    commonjs(),
    nodeResolve({
      module: true,
      jsnext: true,
      main: true,
      browser: true,
      extensions: ['.js']
    }),
    globals(),
    json()
  ]

};



module.exports = rollupConfig;

Thanks for explaining.

If you don’t get an answer here, maybe create an issue here: https://github.com/ionic-team/ionic-cli/issues