title: Passing an argument through package.json to installation script of npm package dependency
body: <p>I have an npm package that configures itself for one of three target platforms when it is being installed as a  (node.js, browser, react-native). Or at least this is my goal, right now it always configures itself for node.js because I have not found a way to give it the desired information.</p>
  
  <p>The solutions that came to my mind have the disadvantage that the developer adding the package dependency has to do something, for example, I could ask them to set an environment variable, which would have to be done each time someone installs or updates modules.</p>
  
  <p>What I would really like is a way to send a parameter to the installation script of the npm module, and that parameter ideally is in <code>package.json</code>, double-ideally in the actual line that configures the dependency on this package.</p>
  
  <p>I found <a href="https://stackoverflow.com/questions/38516338/how-can-i-pass-an-optional-flag-to-a-dependency-of-my-npm-package">this similar question here on SO</a> - but it has no answer, not even a single comment.</p>
  
  <p>I checked the npm documentation but didn't find anything. I can only think of workarounds outside npm. It makes me wonder if I'm doing something wrong with what I'm looking for, or if I'm overlooking something, because it seems to me that this should be if not a common than at least not an extremely rare question? I can't imagine that npm modules configuring themselves to different environments through their installation script in not 100% automatable ways that depend on a provided parameter should be so rare that there aren't even any questions about it. Yet I found none, only discussions about passing parameters to scripts defined in <code>package.json</code>.</p>