How can I pass an optional flag to a dependency of

2019-05-04 18:43发布

I'm working on an npm package, let's call it foo, that has a few external dependencies. One such dependency, bar requires a build flag in order to work with my project. If I were to manually install the dependencies I would say:

npm install bar --bar-option=1 ... # other deps npm install foo node script_that_uses_foo.js

I would like the dependencies of foo to be installed automatically with npm install foo. So I have a section in my package.json file that looks like this: "dependencies" : { "bar": "file:../../bar-0.1.0.tgz", "baz": "*" }

This works fine, except that bar is installed without --bar-option=1. How can I tell npm to pass this argument to the install script of bar? I've looked through the npm documentation and haven't found what I'm looking for.

Thanks for your help.

标签: node.js npm
0条回答
登录 后发表回答