Skip to content

Commit

Permalink
revert to using cjs for lambda (#4967)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris authored May 21, 2022
1 parent cb3c5ec commit a452bd8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/few-scissors-agree.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/adapter-vercel': patch
---

Revert to cjs mode when building for lambda
8 changes: 4 additions & 4 deletions packages/adapter-vercel/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,10 @@ async function v1(builder, external) {
bundle: true,
platform: 'node',
external,
format: 'esm'
format: 'cjs'
});

writeFileSync(`${dirs.lambda}/package.json`, JSON.stringify({ type: 'module' }));
writeFileSync(`${dirs.lambda}/package.json`, JSON.stringify({ type: 'commonjs' }));

builder.log.minor('Copying assets...');

Expand Down Expand Up @@ -271,7 +271,7 @@ async function v3(builder, external, edge, split) {
target: `node${node_version.full}`,
bundle: true,
platform: 'node',
format: 'esm',
format: 'cjs',
external
});

Expand All @@ -284,7 +284,7 @@ async function v3(builder, external, edge, split) {
})
);

write(`${dirs.functions}/${name}.func/package.json`, JSON.stringify({ type: 'module' }));
write(`${dirs.functions}/${name}.func/package.json`, JSON.stringify({ type: 'commonjs' }));

routes.push({ src: pattern, dest: `/${name}` });
}
Expand Down

0 comments on commit a452bd8

Please sign in to comment.