npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

can I override auguments through -- ?

As mentioned in npm docsI can create script below.

"devPush":"webpack --config webpackConf/ --env.dest=test"

Is there a way to override env.dest using npm run devPush -- --env.dest=test2?
Thx in advance.

That really depends on the commands you’re calling. For example, if you have the following test script with mocha:

"test": "mocha -R dot test/*.spec.js",

and you call the script as follows:

npm run test -- -R spec

the reporter (-R) will be spec. It may work for webpack as well. However, this is all depending on the command line argument parsing implementation in each program that could be used in such a script, and I don’t think npm can reasonably account for that.