react-native bundling fails when `require`-ing a html file
See original GitHub issueI 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:
- Created 6 years ago
- Comments:6 (6 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
-.- 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.
I’ll give yours a go and see what I get