vincentriemer / react-native-dom

An experimental, comprehensive port of React Native to the web.
https://rntester.now.sh
MIT License
3.25k stars 73 forks source link

Uncaught SyntaxError: Unexpected token { #99

Open piranna opened 5 years ago

piranna commented 5 years ago

With Chromium 71, trying to add support for react-native-dom to a project I get the error Uncaught SyntaxError: Unexpected token { in file bootstrap.bundle. Looking at the line, the code is provided by react-native-dom itself, seems the braced import statement is not supported by Chromium... Any clue about what could be happening and how can I be able to fix it?

  import { RNDomInstance } from "react-native-dom";
peacechen commented 5 years ago

This could be addressed by transpiling to ES5 using Webpack or Browserify. Projects consuming this may need to turn on the switch to transpile source under node_modules. That could slow down the build though. Alternatively, react-native-dom could publish a minified & transpiled build.

piranna commented 5 years ago

Projects consuming this may need to turn on the switch to transpile source under node_modules.

What's that switch? I'm having this problem in another projects.

Alternatively, react-native-dom could publish a minified & transpiled build.

Yeah, that would be the ideal thing...

peacechen commented 5 years ago

Here's a walk-through for Webpack. There are tutorials out there for Bable and Browserify too. https://medium.com/unhandled-exception/using-non-transpiled-modules-and-webpack-657dca27bd4a

piranna commented 5 years ago

Thank you! :-D