Fix vercel edge private env vars (#6841)

This commit is contained in:
Bjorn Lu 2023-04-14 21:46:24 +08:00 committed by GitHub
parent 00a2e1d7c7
commit 2e3125e180
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View file

@ -0,0 +1,5 @@
---
'@astrojs/vercel': patch
---
Fix vercel edge private environment variables usage

View file

@ -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 }) => {