summaryrefslogtreecommitdiff
path: root/packages/integrations/netlify/src/ssr-function.ts
diff options
context:
space:
mode:
authorGravatar Alexander Niebuhr <alexander@nbhr.io> 2024-06-16 07:25:03 +0200
committerGravatar GitHub <noreply@github.com> 2024-06-16 07:25:03 +0200
commit57dfa2abda46b3dce10e2902465c56dfabb41ff0 (patch)
treeb275fd629f28cc276c4591f329c87dccdba88e8c /packages/integrations/netlify/src/ssr-function.ts
parent898bf11936f4d590b92f63832b11ede3bd4c7cce (diff)
downloadastro-57dfa2abda46b3dce10e2902465c56dfabb41ff0.tar.gz
astro-57dfa2abda46b3dce10e2902465c56dfabb41ff0.tar.zst
astro-57dfa2abda46b3dce10e2902465c56dfabb41ff0.zip
fix: backward compatibility Astro <= 4.9 (#282)
Diffstat (limited to 'packages/integrations/netlify/src/ssr-function.ts')
-rw-r--r--packages/integrations/netlify/src/ssr-function.ts7
1 files changed, 5 insertions, 2 deletions
diff --git a/packages/integrations/netlify/src/ssr-function.ts b/packages/integrations/netlify/src/ssr-function.ts
index dba0dbead..46778ea07 100644
--- a/packages/integrations/netlify/src/ssr-function.ts
+++ b/packages/integrations/netlify/src/ssr-function.ts
@@ -3,10 +3,13 @@ import type { SSRManifest } from 'astro';
import { App } from 'astro/app';
import { applyPolyfills } from 'astro/app/node';
+type EnvSetupModule = typeof import('astro/env/setup');
+
// Won't throw if the virtual module is not available because it's not supported in
// the users's astro version or if astro:env is not enabled in the project
-await import('astro/env/setup')
- .then((mod) => mod.setGetEnv((key) => process.env[key]))
+const setupModule = 'astro/env/setup';
+await import(/* @vite-ignore */ setupModule)
+ .then((mod: EnvSetupModule) => mod.setGetEnv((key) => process.env[key]))
.catch(() => {});
applyPolyfills();