mirror of
https://github.com/withastro/astro.git
synced 2025-02-17 22:44:24 -05:00
Fix backwards compat with Astro <= 4.9 (#11261)
This commit is contained in:
parent
9b030239cb
commit
f5f8ed275b
3 changed files with 16 additions and 4 deletions
6
.changeset/serious-humans-obey.md
Normal file
6
.changeset/serious-humans-obey.md
Normal file
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
'@astrojs/vercel': patch
|
||||
'@astrojs/node': patch
|
||||
---
|
||||
|
||||
Fix backwards compat with Astro <= 4.9
|
|
@ -5,10 +5,13 @@ import { createStandaloneHandler } from './standalone.js';
|
|||
import startServer from './standalone.js';
|
||||
import type { Options } from './types.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();
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Add table
Reference in a new issue