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

Fail to run project: "Module parse failed: Unexpected token", due to coalesing operator #625

Closed
oliverwatkins opened this issue Nov 29, 2023 · 1 comment
Labels

Comments

@oliverwatkins
Copy link

Screenshot

image

Description

I have a project where I am using graphql-request:

Version :

"graphql": "^15.5.0",
"graphql-request": "^6.1.0",

When I run the application this is the error I get :

./node_modules/graphql-request/build/cjs/index.js 132:51
Module parse failed: Unexpected token (132:51)
File was processed with these loaders:
 * ./node_modules/react-scripts/node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
|       variables,
|       operationName,
>       jsonSerializer: fetchOptions.jsonSerializer ?? defaultJsonSerializer_js_1.defaultJsonSerializer
|     });
|   }

I think node is having some trouble with the coalescing operator ??.

I am using Node version 16.20.2 so it should be able to handle coalescing operators.

Reproduction Steps/Repo Link

@jonkoops
Copy link
Collaborator

Looking at the stack trace, this is coming from babel-loader, so I believe that you are using an outdated version of it which does not support this syntax. Since it is a transitive dependency of react-scripts, you'll likely have to update that to the latest version.

@jonkoops jonkoops closed this as not planned Won't fix, can't repro, duplicate, stale Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants