You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm unable to deploy svelte-5 with this adapter and the new svelte.js/ts files with top-level await because the lambda here gets compiled as CJS, which does not support top level await.
I tried passing in esbuild: { format: 'esm' } via the adapter config, and that gets me a little further with a successful deploy - but the resulting lambda function then fails on every request with:
{
"errorType": "Runtime.UserCodeSyntaxError",
"errorMessage": "SyntaxError: Cannot use import statement outside a module",
"stack": [
"Runtime.UserCodeSyntaxError: SyntaxError: Cannot use import statement outside a module",
" at _loadUserApp (file:///var/runtime/index.mjs:1084:17)",
" at async UserFunction.js.module.exports.load (file:///var/runtime/index.mjs:1119:21)",
" at async start (file:///var/runtime/index.mjs:1282:23)",
" at async file:///var/runtime/index.mjs:1288:1"
]
}
my package.json does have "type": "module" but I suspect the issue is specific to the esbuild options.
Any insights you could provide would be greatly appreciated!
The text was updated successfully, but these errors were encountered:
I was able to get this a bit farther by manually adding a package.json alongside the server.js output, it only has { "type": "module" } in it... that then results in a new error about not being able to require "path", which I as able to resolve with this shim via banner/js:
I switched the adapter to deploy: false, and added some additional build steps to stick a simple package.json file into the lambda output directory, and then run the CDK deploy in a separate build step. It does seem to be working, but I'd love to hear if there is any other way to do this!
I'm unable to deploy svelte-5 with this adapter and the new svelte.js/ts files with top-level await because the lambda here gets compiled as CJS, which does not support top level await.
I tried passing in
esbuild: { format: 'esm' }
via the adapter config, and that gets me a little further with a successful deploy - but the resulting lambda function then fails on every request with:my package.json does have
"type": "module"
but I suspect the issue is specific to the esbuild options.Any insights you could provide would be greatly appreciated!
The text was updated successfully, but these errors were encountered: