adapter-vercel — ERROR: Top-level await is currently not supported with the "cjs" output format #5017
Labels
bug
Something isn't working
p1-important
SvelteKit cannot be used by a large number of people, basic functionality is missing, etc.
pkg:adapter-vercel
Pertaining to the Vercel adapter
Milestone
Describe the bug
When building the app with
@sveltejs/adapter-vercel
, and when I use top-levelawait
in my server routes, I get this error:However, my
package.json
specifies"type": "module"
, but it still thinks I'm using cjs when I'm not.Reproduction
https://stackblitz.com/edit/sveltejs-kit-template-default-qgneqz?file=src/routes/helloworld.js
Then, run
npm run build
Logs
System Info
See my StackBlitz link
https://stackblitz.com/edit/sveltejs-kit-template-default-qgneqz?file=svelte.config.js,src%2Froutes%2Fhelloworld.js&terminal=dev
Severity
serious, but I can work around it
Additional Information
I'm using the recommended setup for a new sveltekit app, for which ECMA modules are encourages. That being the case, I believe the module features which are now built into node.js, like top-level
await
, should be usable.The text was updated successfully, but these errors were encountered: