mirror of
https://github.com/withastro/astro.git
synced 2024-12-16 21:46:22 -05:00
fix: vite types (#3352)
* Re-export vite types and added them to zod schema * Removed casted typed * Changeset
This commit is contained in:
parent
7cd4b1bc12
commit
8685506174
4 changed files with 16 additions and 5 deletions
5
.changeset/quick-gorillas-kick.md
Normal file
5
.changeset/quick-gorillas-kick.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'astro': patch
|
||||
---
|
||||
|
||||
Export `ViteUserConfig` type
|
|
@ -255,6 +255,10 @@ type ServerConfig = {
|
|||
port?: number;
|
||||
};
|
||||
|
||||
export interface ViteUserConfig extends vite.UserConfig {
|
||||
ssr?: vite.SSROptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Astro User Config
|
||||
* Docs: https://docs.astro.build/reference/configuration-reference/
|
||||
|
@ -652,7 +656,7 @@ export interface AstroUserConfig {
|
|||
* }
|
||||
* ```
|
||||
*/
|
||||
vite?: vite.UserConfig & { ssr?: vite.SSROptions };
|
||||
vite?: ViteUserConfig;
|
||||
|
||||
experimental?: {
|
||||
/**
|
||||
|
|
|
@ -120,7 +120,7 @@ async function ssrBuild(opts: StaticBuildOptions, internals: BuildInternals, inp
|
|||
const ssr = isBuildingToSSR(astroConfig);
|
||||
const out = ssr ? opts.buildConfig.server : astroConfig.outDir;
|
||||
|
||||
const viteBuildConfig = {
|
||||
const viteBuildConfig: ViteConfigWithSSR = {
|
||||
logLevel: 'error',
|
||||
mode: 'production',
|
||||
css: viteConfig.css,
|
||||
|
@ -165,7 +165,7 @@ async function ssrBuild(opts: StaticBuildOptions, internals: BuildInternals, inp
|
|||
base: astroConfig.base,
|
||||
ssr: viteConfig.ssr,
|
||||
resolve: viteConfig.resolve,
|
||||
} as ViteConfigWithSSR;
|
||||
};
|
||||
|
||||
await runHookBuildSetup({
|
||||
config: astroConfig,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { AstroConfig, AstroUserConfig, CLIFlags } from '../@types/astro';
|
||||
import type { AstroConfig, AstroUserConfig, CLIFlags, ViteUserConfig } from '../@types/astro';
|
||||
import type { Arguments as Flags } from 'yargs-parser';
|
||||
import type * as Postcss from 'postcss';
|
||||
import type { ILanguageRegistration, IThemeRegistration, Theme } from 'shiki';
|
||||
|
@ -182,7 +182,9 @@ export const AstroConfigSchema = z.object({
|
|||
.default([]),
|
||||
})
|
||||
.default({}),
|
||||
vite: z.any().optional().default({}),
|
||||
vite: z
|
||||
.custom<ViteUserConfig>((data) => data instanceof Object && !Array.isArray(data))
|
||||
.default({}),
|
||||
experimental: z
|
||||
.object({
|
||||
ssr: z.boolean().optional().default(false),
|
||||
|
|
Loading…
Reference in a new issue