title: What is the right way to create separate npm modules and use them locally
body: <p>I created a React Native component which lives in a different folder with its own <code>package.json</code> file, and I want to use it in another project</p>
  
  <p><code>MyComponent</code> is located in <code>Workspace/MyComponent</code> and as a few dependencies in <code>package.json</code></p>
  
  <pre><code>  "dependencies": {
      "react-navigation": "^1.0.0-beta.11"
    },
    "peerDependencies": {
      "react": "16.0.0-alpha.12",
      "react-native": "0.45.1"
    },
    "devDependencies": {
      "react": "16.0.0-alpha.12",
      "react-native": "0.45.1"
    }
  </code></pre>
  
  <p>I am currently in the development of <code>MyComponent</code> so I have run <code>npm install</code> in the repo, there is a <code>node_modules</code> folder.</p>
  
  <p>My have linked <code>MyComponent</code> with <code>MyApp</code> which is located in <code>Workspace/MyApp</code>, using <code>npm link</code></p>
  
  <p>Although, when I run <code>MyApp</code> and try to use <code>MyComponent</code>, it complains about duplicated declaration, because <code>react</code> is in both <code>MyComponent</code> and <code>MyApp</code>, and they are linked.</p>
  
  <p>If I remove the <code>node_modules</code> folder from <code>MyComponent</code>, <code>react-navigation</code> complains about <code>react</code> not defined.</p>
  
  <p>In the ReactJS world, webpack for example allow to set the root with the preferred node_modules folder which is great.</p>
  
  <pre><code>module.exports = {
    ...
    resolve: {
      root: path.resolve(__dirname, 'node_modules'),
    }
    ...
  }
  </code></pre>
  
  <p>I wish to do something similar so I don't have duplicated modules and can debug <code>MyComponent</code> in <code>MyApp</code> locally without reinstalling <code>MyComponent</code> for every single change. What is the best approach for me to achieve this?</p>
  
  <p>Thanks</p>