title: How can I make react-native build copy an asset from node_modules to the apk?
body: <p>I am building a react-native app which embeds a WebView in order to host some non-native react components. I have a small html file which is the source for the WebView and lives in a sub-folder of android/app/src/main/assets, which I understand is where it needs to be for the build to copy it to the apk, though I think I will need another copy in another location for IOS. So far so good...this much works.</p>
  
  <p>Now, the htm file needs to pull in the regular react components from code in an npm module. It contains a script tag whose src needs to reference a file which is available in a subdirectory of node_modules. I don't  know of any url I can put in the src that will reference the file direct from node_modules and get it copied to the apk. The simple solution is to manually copy the file into the same subfolder of android/app/src/main/assets and simply use its name as the src. This also works, though there may be a better way.</p>
  
  <p>Problem: how can I automate copying the file from node_modules to assets?
  (Ideally, a solution would also work for IOS, though at this point I'd be glad to have an android-only one.)</p>
  
  <p>I explored rnpm and react-native link. Documentation I can find is very inadequate, but it appears this mechanism can only be used for fonts.</p>
  
  <p>I explored adding a copy command to the start script in package.json, like this:</p>
  
  <pre><code>"scripts": {
      "start": "copy/Y node_modules/X/Ybundle.js android/app/src/main/assets/X/Ybundle.js &amp; node node_modules/react-native/local-cli/cli.js start"
  },
  </code></pre>
  
  <p>but the copy did not happen when I ran react-native start-android.</p>
  
  <p>I am wondering whether something could be added to the react-native project's gradle script, but cannot find any documentation on how this is used in the react native build process.</p>