Skip to content

Commit

Permalink
Fix vercel edge private env vars (#6841)
Browse files Browse the repository at this point in the history
  • Loading branch information
bluwy authored Apr 14, 2023
1 parent 00a2e1d commit 2e3125e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/blue-moons-cough.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@astrojs/vercel': patch
---

Fix vercel edge private environment variables usage
7 changes: 7 additions & 0 deletions packages/integrations/vercel/src/edge/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ export default function vercelEdge({

vite.ssr ||= {};
vite.ssr.target ||= 'webworker';

// Vercel edge runtime is a special webworker-ish environment that supports process.env,
// but Vite would replace away `process.env` in webworkers, so we set a define here to prevent it
vite.define = {
'process.env': 'process.env',
...vite.define,
};
}
},
'astro:build:done': async ({ routes }) => {
Expand Down

0 comments on commit 2e3125e

Please sign in to comment.