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 {
|
return {
|
||||||
name: '@astrojs/vercel',
|
name: '@astrojs/vercel',
|
||||||
hooks: {
|
hooks: {
|
||||||
'astro:config:setup': ({ command, config, injectScript }) => {
|
'astro:config:setup': ({ command, config, updateConfig, injectScript }) => {
|
||||||
if (command === 'build' && analytics) {
|
if (command === 'build' && analytics) {
|
||||||
injectScript('page', 'import "@astrojs/vercel/analytics"');
|
injectScript('page', 'import "@astrojs/vercel/analytics"');
|
||||||
}
|
}
|
||||||
config.outDir = new URL('./static/', getVercelOutput(config.root));
|
const outDir = new URL('./static/', getVercelOutput(config.root));
|
||||||
config.build.format = 'directory';
|
updateConfig({
|
||||||
|
outDir,
|
||||||
|
build: {
|
||||||
|
format: 'directory',
|
||||||
|
},
|
||||||
|
});
|
||||||
},
|
},
|
||||||
'astro:config:done': ({ setAdapter, config }) => {
|
'astro:config:done': ({ setAdapter, config }) => {
|
||||||
setAdapter(getAdapter());
|
setAdapter(getAdapter());
|
||||||
|
|
Loading…
Reference in a new issue