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

Align adapter setup (#6874)

This commit is contained in:
Nathaniel Blackburn 2023-04-19 08:36:46 +01:00 committed by GitHub
parent 1811616104
commit 27aa304ab4

View file

@ -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());