0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-03-10 23:01:26 -05:00

Fix backwards compat with Astro <= 4.9 (#11261)

This commit is contained in:
Matthew Phillips 2024-06-14 16:29:53 -04:00 committed by GitHub
parent e736431f99
commit c797023a59

View file

@ -8,10 +8,13 @@ import {
ASTRO_PATH_PARAM,
} from './adapter.js';
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();