Calling `ionic build --prod` doesn't pass on prod argument to before script

Calling ionic build --prod doesn’t pass on prod argument to before script.
Steps to Reproduce:

  • Add ionic:build:before": "node ./env/environment to the package.json scripts.
  • Create a script file env/environment.js, output process.env.npm_config_argv. I would expect it to contain information .

Question
How can I access the parameter in the script?

Did I understand correctly that you added a script called ionic:build:before to your package.json and want to know how to access parameters that were provided to ionic build?
Is this --prod the parameter you are referring to?

yes exactly…

No idea if this actually supported.

The script is called as it should be? I didn’t know you could just add a :before script and this would work. Nice. Do you have some documentation on this?

You know that --prod has meaning in itself for ionic build? Maybe it works with different parameters…

(Maybe create an issue about this for ionic-cli on Github - seems quite possible that this just wasn’t considered yet)

It appears it is no longer.

See https://github.com/ionic-team/ionic-cli/issues/2594

Make sure to +1 and comment on these so the devs know you also have this need.