mirror of
https://github.com/withastro/astro.git
synced 2024-12-16 21:46:22 -05:00
fix: regression for getViteConfig (#11231)
* fix: regression for getViteConfig * address feedback
This commit is contained in:
parent
8725cb2f90
commit
58d7dbb5e0
2 changed files with 10 additions and 5 deletions
5
.changeset/bright-elephants-yell.md
Normal file
5
.changeset/bright-elephants-yell.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'astro': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fixes a regression for `getViteConfig`, where the inline config wasn't merged in the final config.
|
|
@ -1,4 +1,4 @@
|
||||||
import type { UserConfig } from 'vite';
|
import type { UserConfig as ViteUserConfig } from 'vite';
|
||||||
import type { AstroInlineConfig, AstroUserConfig } from '../@types/astro.js';
|
import type { AstroInlineConfig, AstroUserConfig } from '../@types/astro.js';
|
||||||
import { Logger } from '../core/logger/core.js';
|
import { Logger } from '../core/logger/core.js';
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ export function defineConfig(config: AstroUserConfig) {
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getViteConfig(inlineConfig: UserConfig, inlineAstroConfig: AstroInlineConfig = {}) {
|
export function getViteConfig(userViteConfig: ViteUserConfig, inlineAstroConfig: AstroInlineConfig = {}) {
|
||||||
// Return an async Vite config getter which exposes a resolved `mode` and `command`
|
// Return an async Vite config getter which exposes a resolved `mode` and `command`
|
||||||
return async ({ mode, command }: { mode: string; command: 'serve' | 'build' }) => {
|
return async ({ mode, command }: { mode: string; command: 'serve' | 'build' }) => {
|
||||||
// Vite `command` is `serve | build`, but Astro uses `dev | build`
|
// Vite `command` is `serve | build`, but Astro uses `dev | build`
|
||||||
|
@ -34,8 +34,8 @@ export function getViteConfig(inlineConfig: UserConfig, inlineAstroConfig: Astro
|
||||||
dest: nodeLogDestination,
|
dest: nodeLogDestination,
|
||||||
level: 'info',
|
level: 'info',
|
||||||
});
|
});
|
||||||
const { astroConfig: config, userConfig } = await resolveConfig(inlineAstroConfig, cmd);
|
const { astroConfig: config } = await resolveConfig(inlineAstroConfig, cmd);
|
||||||
let settings = await createSettings(config, inlineConfig.root);
|
let settings = await createSettings(config, userViteConfig.root);
|
||||||
settings = await runHookConfigSetup({ settings, command: cmd, logger });
|
settings = await runHookConfigSetup({ settings, command: cmd, logger });
|
||||||
const viteConfig = await createVite(
|
const viteConfig = await createVite(
|
||||||
{
|
{
|
||||||
|
@ -48,6 +48,6 @@ export function getViteConfig(inlineConfig: UserConfig, inlineAstroConfig: Astro
|
||||||
{ settings, logger, mode }
|
{ settings, logger, mode }
|
||||||
);
|
);
|
||||||
await runHookConfigDone({ settings, logger });
|
await runHookConfigDone({ settings, logger });
|
||||||
return mergeConfig(viteConfig, userConfig);
|
return mergeConfig(viteConfig, userViteConfig);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue