diff options
author | 2024-06-20 15:54:54 +0200 | |
---|---|---|
committer | 2024-06-20 15:54:54 +0200 | |
commit | 2a0181f9959f63684e2daaa44da0d825bafc3868 (patch) | |
tree | 149dea59393a7e7c0b6953fbcd20c4fe4b33b110 /packages/integrations/node/src/index.ts | |
parent | cce24e1a22e35b8cb28e481994847d1dc8f93616 (diff) | |
download | astro-2a0181f9959f63684e2daaa44da0d825bafc3868.tar.gz astro-2a0181f9959f63684e2daaa44da0d825bafc3868.tar.zst astro-2a0181f9959f63684e2daaa44da0d825bafc3868.zip |
fix: astro:env getSecret (#11296)
Diffstat (limited to 'packages/integrations/node/src/index.ts')
-rw-r--r-- | packages/integrations/node/src/index.ts | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/packages/integrations/node/src/index.ts b/packages/integrations/node/src/index.ts index e11576990..eb3c98a9b 100644 --- a/packages/integrations/node/src/index.ts +++ b/packages/integrations/node/src/index.ts @@ -24,6 +24,16 @@ export function getAdapter(options: Options): AstroAdapter { }; } +// TODO: remove once we don't use a TLA anymore +async function shouldExternalizeAstroEnvSetup() { + try { + await import('astro/env/setup'); + return false; + } catch { + return true; + } +} + export default function createIntegration(userOptions: UserOptions): AstroIntegration { if (!userOptions?.mode) { throw new AstroError(`Setting the 'mode' option is required.`); @@ -33,7 +43,7 @@ export default function createIntegration(userOptions: UserOptions): AstroIntegr return { name: '@astrojs/node', hooks: { - 'astro:config:setup': ({ updateConfig, config }) => { + 'astro:config:setup': async ({ updateConfig, config }) => { updateConfig({ image: { endpoint: config.image.endpoint ?? 'astro/assets/endpoint/node', @@ -41,6 +51,11 @@ export default function createIntegration(userOptions: UserOptions): AstroIntegr vite: { ssr: { noExternal: ['@astrojs/node'], + ...((await shouldExternalizeAstroEnvSetup()) + ? { + external: ['astro/env/setup'], + } + : {}), }, }, }); |