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

SyntaxError: Unexpected token 'export' v 3.0.2 #6666

Closed
3axap4eHko opened this issue Jul 21, 2020 · 3 comments
Closed

SyntaxError: Unexpected token 'export' v 3.0.2 #6666

3axap4eHko opened this issue Jul 21, 2020 · 3 comments
Assignees
Labels
🏓 awaiting-contributor-response requires input from a contributor
Milestone

Comments

@3axap4eHko
Copy link

Intended outcome:

import { ApolloLink } from '@apollo/client/link/core';

Actual outcome:

/node_modules/@apollo/client/link/core/index.js:1
export { empty } from './empty';
^^^^^^
SyntaxError: Unexpected token 'export'

Versions

  System:
    OS: Linux 4.19 Ubuntu 18.04.4 LTS (Bionic Beaver)
  Binaries:
    Node: 14.4.0 - ~/.nvm/versions/node/v14.4.0/bin/node
    Yarn: 1.22.4 - /mnt/c/Program Files (x86)/Yarn/bin/yarn
    npm: 6.14.5 - ~/.nvm/versions/node/v14.4.0/bin/npm
  npmPackages:
    @apollo/client: ^3.0.2 => 3.0.2 
    @apollo/react-hooks: ^4.0.0 => 4.0.0 
    apollo-link-persisted-queries: ^0.2.2 => 0.2.2 
    react-apollo: ^3.1.5 => 3.1.5
@benjamn
Copy link
Member

benjamn commented Jul 21, 2020

@apollo/client/link/core is not a public entry point in 3.0.2 (because it doesn't have a package.json file), but it will soon become one in @apollo/client@3.1.0, thanks to #6656.

To explain the error, Node.js is trying to import @apollo/client/link/core/index.js (which is ESM rather than CommonJS) but fails because Node doesn't natively understand ESM import/export syntax yet.

@benjamn benjamn added this to the Post 3.0 milestone Jul 21, 2020
@benjamn
Copy link
Member

benjamn commented Jul 23, 2020

Heads up: we're not quite ready to publish @apollo/client@3.1.0 yet, but I've published an @apollo/client@3.1.0-pre.0 release that I believe will resolve this issue, if you want to try that in the meantime. 🙏

@benjamn benjamn added the 🏓 awaiting-contributor-response requires input from a contributor label Jul 23, 2020
@benjamn benjamn self-assigned this Jul 23, 2020
@hwillson
Copy link
Member

hwillson commented May 4, 2021

Let us know if this is still a concern with @apollo/client@latest - thanks!

@hwillson hwillson closed this as completed May 4, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🏓 awaiting-contributor-response requires input from a contributor
Projects
None yet
Development

No branches or pull requests

3 participants