From 43230b2cac6c28e0412b77d32f06db416fca8560 Mon Sep 17 00:00:00 2001 From: Nathaniel Blackburn Date: Wed, 19 Apr 2023 08:36:46 +0100 Subject: [PATCH] Align adapter setup (#6874) --- .changeset/hungry-lizards-float.md | 5 +++++ packages/integrations/vercel/src/static/adapter.ts | 11 ++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 .changeset/hungry-lizards-float.md diff --git a/.changeset/hungry-lizards-float.md b/.changeset/hungry-lizards-float.md new file mode 100644 index 000000000000..fdac0767ba9c --- /dev/null +++ b/.changeset/hungry-lizards-float.md @@ -0,0 +1,5 @@ +--- +'@astrojs/vercel': patch +--- + +Refactor static adapter to use updateConfig method diff --git a/packages/integrations/vercel/src/static/adapter.ts b/packages/integrations/vercel/src/static/adapter.ts index c03c78218b40..5455edbc0a7e 100644 --- a/packages/integrations/vercel/src/static/adapter.ts +++ b/packages/integrations/vercel/src/static/adapter.ts @@ -19,12 +19,17 @@ export default function vercelStatic({ analytics }: VercelStaticConfig = {}): As return { name: '@astrojs/vercel', hooks: { - 'astro:config:setup': ({ command, config, injectScript }) => { + 'astro:config:setup': ({ command, config, updateConfig, injectScript }) => { if (command === 'build' && analytics) { injectScript('page', 'import "@astrojs/vercel/analytics"'); } - config.outDir = new URL('./static/', getVercelOutput(config.root)); - config.build.format = 'directory'; + const outDir = new URL('./static/', getVercelOutput(config.root)); + updateConfig({ + outDir, + build: { + format: 'directory', + }, + }); }, 'astro:config:done': ({ setAdapter, config }) => { setAdapter(getAdapter());