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.

react-native bundling fails when `require`-ing a html file

See original GitHub issue

I have no idea why this works in your Expo example but not in my normal react-native project, but when I do

<WebView source={require('./webview.html')} style={{ flex: 1, borderWidth: 2, borderColor: 'red' }} ref={this._refWebView}/>

I get the following error:

Bundling index.ios.js 0.0% (0/1), failed. SyntaxError: …/src/components/Header/components/webview.html: Unexpected token (1:1)

1 | <!DOCTYPE html>
  |  ^
2 | <html lang="en">
3 | <head>
4 |   <meta charset="UTF-8">

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
dave-irvinecommented, Aug 3, 2017

-.- for reasons I don’t know (and this seems to happen more than I like), killing the simulator, packager, and restarting everything has fixed the problem.

0reactions
dave-irvinecommented, Aug 3, 2017

I’ll give yours a go and see what I get

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues - GitHub
error: bundling failed: Error: Unable to resolve module `./$.html` from `E:\React\demo\node_modules\core-js\modules\es5.js`: The module `./$.
Read more >
0 - Stack Overflow
I have fixed my issue by going to node_modules/core-js/modules/$.html.js and duplicate + rename $.html.js to $.html.
Read more >
AppRegistry - React Native
AppRegistry is the JS entry point to running all React Native apps. App root components should register themselves with AppRegistry.
Read more >
Tutorial: Create a Node.js and React app in Visual Studio
Webpack bundles JavaScript files so they can run in a browser, and can also ... Visual Studio requires only one version, and the...
Read more >
How to import files from outside of root directory with React ...
How to import files from outside of root directory with React Native Metro bundler ... error: bundling failed: Error: Unable to resolve module...
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