From 4b48d1bd5005dc8e059b17fa42f0d08674aad30c Mon Sep 17 00:00:00 2001 From: Juan Manuel Villacorta Campos <37244056+juanvillacortac@users.noreply.github.com> Date: Tue, 30 Aug 2022 09:08:23 -0400 Subject: [PATCH] Fix `global is not defined` on vercel edge (#6425) * Fix `global is not defined` on vercel edge * Update packages/adapter-vercel/index.js Co-authored-by: Rich Harris --- .changeset/rare-wolves-deliver.md | 5 +++++ packages/adapter-vercel/index.js | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changeset/rare-wolves-deliver.md diff --git a/.changeset/rare-wolves-deliver.md b/.changeset/rare-wolves-deliver.md new file mode 100644 index 000000000000..a9a669e5edc7 --- /dev/null +++ b/.changeset/rare-wolves-deliver.md @@ -0,0 +1,5 @@ +--- +'@sveltejs/adapter-vercel': patch +--- + +Fix `global is not defined` runtime error building with `edge: true` option diff --git a/packages/adapter-vercel/index.js b/packages/adapter-vercel/index.js index 0d0ba443385c..37027c836f7a 100644 --- a/packages/adapter-vercel/index.js +++ b/packages/adapter-vercel/index.js @@ -189,7 +189,8 @@ export default function ({ external = [], edge, split } = {}) { platform: 'browser', format: 'esm', external, - sourcemap: 'linked' + sourcemap: 'linked', + banner: { js: 'globalThis.global = globalThis;' } }); write(