diff options
author | 2025-01-20 10:02:22 +0000 | |
---|---|---|
committer | 2025-01-20 10:02:22 +0000 | |
commit | 2ca5b4b487abb5c5b3cc64922894c36e207c38ab (patch) | |
tree | ef333d0aacafc7422ae8c54a5c7c2eee97f45b68 /packages/integrations/vercel/src | |
parent | 0201787ead8cc640ae9a47930be6cfcec3b1f364 (diff) | |
download | astro-2ca5b4b487abb5c5b3cc64922894c36e207c38ab.tar.gz astro-2ca5b4b487abb5c5b3cc64922894c36e207c38ab.tar.zst astro-2ca5b4b487abb5c5b3cc64922894c36e207c38ab.zip |
fix(vercel): copy static assets after all integrations (#508)
* fix(vercel): copy static assets after all integrations
* Format
* Fix logic
* Format
Diffstat (limited to 'packages/integrations/vercel/src')
-rw-r--r-- | packages/integrations/vercel/src/index.ts | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/packages/integrations/vercel/src/index.ts b/packages/integrations/vercel/src/index.ts index 2360de5e1..af2ede2f2 100644 --- a/packages/integrations/vercel/src/index.ts +++ b/packages/integrations/vercel/src/index.ts @@ -215,6 +215,20 @@ export default function vercelAdapter({ format: 'directory', redirects: false, }, + integrations: [ + { + name: 'astro:copy-vercel-output', + hooks: { + 'astro:build:done': async () => { + if (_buildOutput === 'static') { + cpSync(_config.outDir, new URL('./.vercel/output/static/', _config.root), { + recursive: true, + }); + } + }, + }, + }, + ], vite: { ssr: { external: ['@vercel/nft'], @@ -308,13 +322,13 @@ export default function vercelAdapter({ if (existsSync(staticDir)) { emptyDir(staticDir); } - mkdirSync(new URL('./.vercel/output/static/', _config.root), { recursive: true }); + mkdirSync(new URL('./.vercel/output/static/', _config.root), { + recursive: true, + }); - if (_buildOutput === 'static' && staticDir) { - cpSync(_config.outDir, new URL('./.vercel/output/static/', _config.root), { - recursive: true, - }); - } else { + mkdirSync(new URL('./.vercel/output/server/', _config.root)); + + if (_buildOutput !== 'static') { cpSync(_config.build.client, new URL('./.vercel/output/static/', _config.root), { recursive: true, }); |