title: React Native WebView offline-first or local content
body: <p>I am building React Native application with integrated <a href="https://appcenter.ms/" rel="nofollow noreferrer">AppCenter</a> SDKs (analytics, crash reporting, <strong>CodePush</strong> for in-app updates). This application is only a 'wrapper' for our online web presentation. The requirement is to make it <strong>offline-first</strong> with possibility to update the wrapper or web presentation.</p>
  
  <p>My idea was to attach web presentation files to React Native project and WebView with local HTML source. <strong>BUT</strong> - it works only in emulator. React Native packager (or bundler) is possible to render full HTML file with all it's internal dependencies (JS, fonts, CSS, other assets). Like this:</p>
  
  <pre><code>import htmlSource from './presentation/index.html'
  
  &lt;WebView
      source={htmlSource}
      style={styles.webview}
  /&gt;
  </code></pre>
  
  <p>This works fine on emulator, but when I create a production build, JS bundle does not contain any HTML dependencies so presentation is only raw HTML without styles and any other assets. So I am not able to render full presentation with WebView. Creating CodePush release (for in-app update) is the same - without assets.</p>
  
  <p><strong>Do you have any ideas how to make this working?</strong> I need to be able to render presentation when device is offline but when is connected, be able to update it.</p>
  
  <p>We do not want to make a full deploy process to App Store, because of its long review/verify process.</p>
  
  <p>Why it works on emulator but in production build it does not work? Is it possible to make a bundle different way to attach all HTMl file dependencies? Or is it possible to offline-cache the WebView content if I point to URL address? </p>
  
  <p>Thanks for any ideas.</p>