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.

Unexpected token, expected ";"

See original GitHub issue

I’m trying to use this plugin with React Native but am stuck with this error: screen shot 2018-11-09 at 1 39 59 pm

Node version: 8.10 Plugin version: 2.6.2

My files are as such: .babelrc

{
  "presets": ["module:metro-react-native-babel-preset"],
  "plugins": ["react-native-paper/babel", "import-graphql"]
}

all-cattles.query.graphql

query allCattles {
  listCattle {
    name
  }
}

Please let me know if there’s anything else needed. Thanks

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jefflewiscommented, May 30, 2019

I was seeing this, but incorrectly included graphql in my sourceExts instead of assetExts in my metro config as described here in https://github.com/detrohutt/babel-plugin-import-graphql/issues/50.

This worked for me:

module.exports = {
  resolver: {
    assetExts: ["graphql", "gql", "png"],
  },
  transformer: {
    babelTransformerPath: require.resolve(
      "react-native-typescript-transformer"
    ),
    enableBabelRCLookup: true
  }
};
0reactions
detrohuttcommented, May 30, 2019

I’m closing this for now since it’s been open for almost 7 months and only has one +1. If the solution @jefflewis mentioned doesn’t work for someone, and you get this same error, let me know and I’ll reopen the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

reactjs - React - unexpected token, expected ; - Stack Overflow
The reason your component is experiencing this error is because of the following: 1. If you define a function outside of an ES6...
Read more >
SyntaxError: Unexpected token - JavaScript - MDN Web Docs
The JavaScript exceptions "unexpected token" occur when a specific language construct was expected, but something else was provided.
Read more >
React Native: Unexpected token ':'. Expected a ')' or a ',' after a ...
Current and expected behavior​​ App shows red box with the error: SyntaxError: Unexpected token ':'. Expected a ')' or a ',' after a...
Read more >
Unexpected token, expected "," : r/reactjs - Reddit
Hey guys, I'm loading some data coming from an API and now I want to add some conditions, as you can see below...
Read more >
unexpected token, expected "," jest - You.com | The AI Search ...
It appears to me that there is an issue in the package you're using. It's trying to use ES modules syntax (import /...
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