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.

Unhandled JS Exception: Syntax Error

See original GitHub issue

Couldn’t make it work on React Native.

screenshot

{
  "presets": [
    "es2015",
    "react-native",
    "react-native-stage-0/decorator-support"
  ],
  "plugins": [
    "transform-es2015-parameters",
    ["extensible-destructuring", {"mode": "optout", "impl": "safe"}]
  ]
}

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:1
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
cooperkacommented, Apr 18, 2017

I started getting this error again as of RN v0.43; I made a PR to improve debug messages: https://github.com/facebook/react-native/pull/13561. You can manually copy the changes there into your node_modules/react-native (at least until the PR is published in the next version) to get a better idea of what’s going wrong.

For me, module.exports is being transformed strangely and the error reason is Unexpected keyword 'var'. This occurs in several places, not just for moment-timezone:

Working bundled code using mode optin:

__d(/* moment-timezone/data/packed/latest.json */function(global, require, module, exports) {
module.exports = module.exports = {
	"version": "2017b",
...

Failing bundled code using mode optout:

__d(/* moment-timezone/data/packed/latest.json */function(global, require, module, exports) {
module.exports = var __extensible_get__ = require("extensible-runtime").immutable;

module.exports = {
	"version": "2017b",
...

I’ll try to diagnose further, but for now I’m just continuing to use mode optin.

0reactions
kimowncommented, Sep 15, 2017

Same error, I want to use immutable.js in my RN project .

RN version:0.38.0

I use mode optout, impl immutable in .babelrc , then I start the RN project,

image

Then I download the bundle file, and rename to index.android.bundle?platform=android.js, and run node index.android.bundle?platform=android.js image

@tomaskulich I only know a little about babel plugin, I use babel-plugin-extensible-destructuring in many production projects and these projects are all raect web projects, I really thank you for you work. Today it my first time try to use this plugin in RN project, does this plugin doesn’t work in RN project?

Read more comments on GitHub >

github_iconTop Results From Across the Web

IOS - React Native - Unhandled JS Exception: SyntaxError
I have facing problem whenever I create a new React Native project. displayed red screen, and got following error message ...
Read more >
[Solved]-IOS - React Native - Unhandled JS Exception: SyntaxError
So just start the tutorial again and use: react-native init AwesomeProject --version 0.38.0. This solved the problem for me. Have fun. Ayalon Grinfeld...
Read more >
SyntaxError: missing ) after argument list - JavaScript | MDN
The JavaScript exception "missing ) after argument list" occurs when there is an error with how a function is called. This might be...
Read more >
How to catch syntax errors in JavaScript? - Tutorialspoint
SyntaxError cannot be handled in js using try-catch blocks because they are thrown errors while the code is being parsed. To handle SyntaxError, ......
Read more >
Errors | Node.js v19.3.0 Documentation
For all EventEmitter objects, if an 'error' event handler is not provided, the error will be thrown, causing the Node.js process to report...
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