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 'export' #685

Open
2 tasks
viviando1110 opened this issue May 22, 2023 · 4 comments
Open
2 tasks

Unexpected token 'export' #685

viviando1110 opened this issue May 22, 2023 · 4 comments

Comments

@viviando1110
Copy link

I'm submitting a...

  • [x ] bug
  • feature
  • chore

What is the current behavior

cannot build, Unexpected token 'export'

What is the expected behavior

can build using example code

Please tell us about your environment

  • Version: 2.0.1
  • Browser: [all | Chrome XX | Firefox XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari ]

Other information

Getting this error:

rts/lib/index.js:1
export * from "@react-financial-charts/annotations";
^^^^^^

SyntaxError: Unexpected token 'export'
at internalCompileFunction (node:internal/vm:73:18)
at wrapSafe (node:internal/modules/cjs/loader:1195:20)
at Module._compile (node:internal/modules/cjs/loader:1239:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1329:10)
at Module.load (node:internal/modules/cjs/loader:1133:32)
at Module._load (node:internal/modules/cjs/loader:972:12)
at Module.require (node:internal/modules/cjs/loader:1157:19)
at require (node:internal/modules/helpers:119:18)

I'm using Typescript 5.0.2 and react 18.2.0, node 19

Is this combination supported? Or should I use a different version?

@andyevers
Copy link

I get this same error when trying to build using next.js 12 and react 18.

@turtlemana
Copy link

if you are using next.js use dynamic imports like this.

const CandleChart = dynamic(() => import("components/charts/CandleChart"), {
  ssr: false,
});

@abforce
Copy link

abforce commented Aug 17, 2023

This is because this library doesn't support commonjs, it only supports ESM.

@newddobi
Copy link

if you are using next.js use dynamic imports like this.

const CandleChart = dynamic(() => import("components/charts/CandleChart"), {
  ssr: false,
});

Can i ask what's your next.js version? Because I tried your solution, still can't build the project. But it works when dev mode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants