Skip to content

Commit

Permalink
fix(netlify-edge): support environment variables
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed May 16, 2023
1 parent 41a4a6a commit 5c85c14
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ const NitroDefaults: NitroConfig = {
"unenv/runtime/polyfill/",
"node-fetch-native/polyfill",
"node-fetch-native/dist/polyfill",
resolve(runtimeDir, "polyfill/"),
],
replace: {},
node: true,
Expand Down
3 changes: 3 additions & 0 deletions src/presets/netlify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ export const netlifyEdge = defineNitroPreset({
format: "esm",
},
},
unenv: {
polyfill: ["#internal/nitro/polyfill/deno-env"],
},
hooks: {
"rollup:before": (nitro: Nitro) => deprecateSWR(nitro),
async compiled(nitro: Nitro) {
Expand Down
2 changes: 2 additions & 0 deletions src/runtime/polyfill/deno-env.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// @ts-expect-error Deno global
Object.assign(process.env, Deno.env.toObject());

0 comments on commit 5c85c14

Please sign in to comment.