8000 feat: use edge-light condition when building for Vercel Edge Runtime … · sveltejs/kit@ee81145 · GitHub
[go: up one dir, main page]

Skip to content

Commit ee81145

Browse files
feat: use edge-light condition when building for Vercel Edge Runtime (#13720)
* feat: use edge-light condition when building for Vercel Edge Runtime * fmt * Update packages/adapter-vercel/index.js * Update packages/adapter-vercel/index.js * changeset --------- Co-authored-by: Tee Ming <chewteeming01@gmail.com> Co-authored-by: Chew Tee Ming <chew.tee.ming@nindatech.com>
1 parent 0656e11 commit ee81145

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

.changeset/silly-ears-visit.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sveltejs/adapter-vercel': patch
3+
---
4+
5+
fix: include the `edge-light` bundling condition when building edge functions

packages/adapter-vercel/index.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,19 @@ const plugin = function (defaults = {}) {
137137
const result = await esbuild.build({
138138
entryPoints: [`${tmp}/edge.js`],
139139
outfile: `${dirs.functions}/${name}.func/index.js`,
140-
target: 'es2020', // TODO verify what the edge runtime supports
140+
// minimum Node.js version supported is v14.6.0 that is mapped to ES2019
141+
// https://edge-runtime.vercel.app/features/polyfills
142+
// TODO verify the latest ES version the edge runtime supports
143+
target: 'es2020',
141144
bundle: true,
142145
platform: 'browser',
146+
conditions: [
147+
// Vercel's Edge runtime key https://runtime-keys.proposal.wintercg.org/#edge-light
148+
'edge-light',
149+
// re-include these since they are included by default when no conditions are specified
150+
// https://esbuild.github.io/api/#conditions
151+
'module'
152+
],
143153
format: 'esm',
144154
external: [
145155
...compatible_node_modules,

0 commit comments

Comments
 (0)
0