powersync-js icon indicating copy to clipboard operation
powersync-js copied to clipboard

SyntaxError: Unexpected token 'export'

Open mednche opened this issue 10 months ago • 3 comments

I am running:

I get SyntaxError: Unexpected token 'export' when I run import { usePowerSync } from '@powersync/react'; The error message says the error is located in powersync/react/lib/index.js.

I have added 'use client'; at the top of all the files that deal with powersync.

Any idea what is going on? Is this an incompatibility with the version of React or Nextjs I have installed?

mednche avatar Mar 25 '25 06:03 mednche

Hey @mednche can you share a little more information on how you're compiling the app? Are you using Turbopack for Next.js application?

michaelbarnes avatar Mar 25 '25 20:03 michaelbarnes

Hi @michaelbarnes, no I am not using Turbopack. Are there some known incompatibilities with Turbopack? What sort of information would you like me to share about how I'm compiling the app?

mednche avatar Mar 26 '25 00:03 mednche

@michaelbarnes, any idea what the Unexpected token 'export' means?

  • I use javascript rather than typescript in my project. Could this be related at all?
  • Could it be a clash in Node version between my app and the powersync/react lib? I use Node v20.15.1.

Any suggestions welcome as I have been stuck on this for 2 weeks now...

mednche avatar Apr 10 '25 15:04 mednche