Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unexpected token { #236

Closed
samuelwong613 opened this issue Nov 23, 2017 · 2 comments
Closed

unexpected token { #236

samuelwong613 opened this issue Nov 23, 2017 · 2 comments

Comments

@samuelwong613
Copy link

Hi, I use react-native and babel-plugin-module-resolver, and I got the error
Unexpected token {
in index.ios.js

I added the extension already:
['.js', '.ios.js', '.android.js']

And now I am using babel-plugin-module-alias, and it work fine.
Any idea? Thanks.

@tleunen
Copy link
Owner

tleunen commented Dec 11, 2017

Can you provide more info?

futagoza added a commit to futagoza/babel-preset-futagozaryuu that referenced this issue Mar 24, 2018
@futagoza
Copy link
Contributor

futagoza commented Mar 24, 2018

I have been having issues with my babel preset since v2.12 (released in November 2017), but only when testing on Travis using Node.js v4.

The problem? Same error Unexpected token { being thrown, but since the error logs gave no indication, I couldn't find the source of the problem for months, but today I just switched to using Yarn in this preset's repository and pushed the changes to GitHub/Travis, and that's when Yarn's enforced Node version check threw an error pointing to this module, complaining about not having the minimum version of Node.js installed (see #285).

After some more digging in the source for babel-plugin-module-resolver, it turns out since Babel is transpiling for Node.js v6, syntax features not supported by Node.js v4 are throwing this error.

EDIT:
Fixed the problem in my babel-preset by forking this repo and reverting (and resolving conflicts) #222

tleunen pushed a commit that referenced this issue Mar 24, 2018
amosyuen pushed a commit to amosyuen/babel-plugin-module-resolver that referenced this issue Jul 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants