Align adapter setup (#6874)
This commit is contained in:
parent
dec072f57f
commit
43230b2cac
2 changed files with 13 additions and 3 deletions
5
.changeset/hungry-lizards-float.md
Normal file
5
.changeset/hungry-lizards-float.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'@astrojs/vercel': patch
|
||||
---
|
||||
|
||||
Refactor static adapter to use updateConfig method
|
|
@ -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());
|
||||
|
|
Loading…
Reference in a new issue