question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error Opening HTML File with Bundled JS and CSS in Android

See original GitHub issue

EDIT: This issue is a duplicate of the one already discussed here: https://github.com/react-native-community/react-native-webview/issues/428

Original Text: HTML file with CSS and JavaScript bundled using Parcel or WebPack does not display in WebView. The bundled file displays fine when opened directly in a desktop browser. Additionally, the WebView is able to successfully open a regular web page.

The HTML file is imported into the component containing the WebView using the following code const index = require('./dist/index.html');

This can be reproduced by creating an Expo project with a WebView in it. Building an HTML file with CSS and JS bundled into it, and then importing that file for use into the WebView. The Github repo at https://github.com/reggie3/react-native-webview-bundle-demo has a project demonstrates this technique and also reproduces this issue.

The expected behavior is that the HTML file is rendered correctly. The bundling technique has worked successfully in the past. I have used it successfully in the react-native-webview-leaflet project.

I a

Environment:

Edit: I updated the repo to follow the style of react-native-webview-leaflet more closely and now the webview shows the text of the bundled file. Screenshot_20190623-123533

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7

github_iconTop GitHub Comments

2reactions
smontlouiscommented, Jun 27, 2019

@reggie3 how did you fix it ? Everything was working fine for me, then I suddenly got this issue.

0reactions
lumixrakucommented, Apr 27, 2020

same problem,it loads source code, not rendering html.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error Opening HTML File with Bundled JS and CSS in Android
The expected behavior is that the HTML file is rendered correctly. The bundling technique has worked successfully in the past. I have used...
Read more >
Android Webview HTML Loading Javascript Problem
Here is where the problem is. My WebView renders the HTML just fine. It even loads and applies the CSS perfectly. However, it...
Read more >
Loading in-app content - Android Developers
Your app may need to load a mix of in-app content and content from the internet, such as an in-app HTML page styled...
Read more >
Why can't Chrome read a local HTML file on Android? - Quora
You have to grant Chrome permission to access the Android File System. Then opening a html page including javascript, css and images should...
Read more >
Handling common JavaScript problems - MDN Web Docs
In the previous article we described some of the ways in which HTML and CSS errors and unrecognized features can be handled due...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found