Quantcast
Channel: Active questions tagged svelte - Stack Overflow
Viewing all articles
Browse latest Browse all 1541

How to update js build process to fix "SyntaxError: Cannot use import statement outside a module"

$
0
0

I am having an easily reproducible error with the npm library @capacitor-community/apple-sign-in.

You can reproduce by running:

npm create svelte@latest my-appcd my-appnpm installnpm i @capacitor-community/apple-sign-in

Then add usage of @capacitor-community/apple-sign-in such as in src/routes/Header.svelte.

Then, npm run build will reproduce the failure.

The error is SyntaxError: Cannot use import statement outside a module.

This can also be reproduced by cloning my demo repo and npm run build.

The plugin seems to not have this issue with create-react-app apps, so it seems to be an issue with how the build is happening for default svelte apps.

I am guessing this can be fixed using babel, esbuild, or vite features, so I am reaching out to stack overflow hoping to find a workaround.


Viewing all articles
Browse latest Browse all 1541

Trending Articles