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

chore(next): astro:env cleanup (#385)

This commit is contained in:
Florian Lefebvre 2024-09-12 17:34:59 +02:00 committed by GitHub
parent 4d6e5601ab
commit e7e4e9e99e
3 changed files with 8 additions and 17 deletions

View file

@ -260,10 +260,7 @@ export default function vercelServerless({
vite: {
...getSpeedInsightsViteConfig(speedInsights?.enabled),
ssr: {
external: [
'@vercel/nft',
...((await shouldExternalizeAstroEnvSetup()) ? ['astro/env/setup'] : []),
],
external: ['@vercel/nft'],
},
},
...getAstroImageConfig(
@ -426,16 +423,6 @@ export default function vercelServerless({
type Runtime = `nodejs${string}.x`;
// TODO: remove once we don't use a TLA anymore
async function shouldExternalizeAstroEnvSetup() {
try {
await import('astro/env/setup');
return false;
} catch {
return true;
}
}
class VercelBuilder {
readonly NTF_CACHE = {};

View file

@ -1,6 +1,9 @@
// Keep at the top
import './polyfill.js';
import type { IncomingMessage, ServerResponse } from 'node:http';
import type { SSRManifest } from 'astro';
import { NodeApp, applyPolyfills } from 'astro/app/node';
import { NodeApp } from 'astro/app/node';
import { setGetEnv } from 'astro/env/setup';
import {
ASTRO_LOCALS_HEADER,
@ -9,8 +12,6 @@ import {
ASTRO_PATH_PARAM,
} from './adapter.js';
// Run polyfills immediately so any dependent code can use the globals
applyPolyfills();
setGetEnv((key) => process.env[key]);
export const createExports = (

View file

@ -0,0 +1,3 @@
import { applyPolyfills } from 'astro/app/node';
applyPolyfills();