-
Notifications
You must be signed in to change notification settings - Fork 77
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
In jiti v1.12.9 (via nuxt 2.15.8), top-level await
doesn't seem to be supported, although it is in Node.js v14+.
See also https://v8.dev/features/top-level-await
When starting my Nuxt app (with top-level await
in a server middleware ESM module), I get the following error:
ERROR ServerMiddleware Error: await is only valid in async function 21:52:20
const schemas = await Promise.all([
^^^^^
SyntaxError: await is only valid in async function
at new Script (vm.js:102:7)
at createScript (vm.js:262:10)
at Object.runInThisContext (vm.js:310:10)
at g (node_modules/jiti/dist/jiti.js:1:54973)
at tests/fixture-valid.js:3:44
at g (node_modules/jiti/dist/jiti.js:1:55111)
at ui/api/routes/fixtures/from-editor.js:12:21
at g (node_modules/jiti/dist/jiti.js:1:55111)
at ui/api/routes.js:3:19
at g (node_modules/jiti/dist/jiti.js:1:55111)
cawa-93, aleclarson, felladrin, haltcase, hendrysadrak and 16 more
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request