can I override auguments through -- ?


(Mr.Nobody) #1

As mentioned in npm docsI can create script below.

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

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


(Lars Willighagen) #2

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.


(system) #3

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.