feat(build): allow overriding vite config loading (#2750)

pull/2753/head
Divyansh Singh 11 months ago committed by GitHub
parent 0f421d7222
commit 1bed154612
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -6,7 +6,7 @@ import {
normalizePath,
type BuildOptions,
type Rollup,
type UserConfig as ViteUserConfig
type InlineConfig as ViteInlineConfig
} from 'vite'
import { APP_PATH } from '../alias'
import type { SiteConfig } from '../config'
@ -50,7 +50,9 @@ export async function bundle(
// resolve options to pass to vite
const { rollupOptions } = options
const resolveViteConfig = async (ssr: boolean): Promise<ViteUserConfig> => ({
const resolveViteConfig = async (
ssr: boolean
): Promise<ViteInlineConfig> => ({
root: config.srcDir,
cacheDir: config.cacheDir,
base: config.site.base,
@ -136,7 +138,8 @@ export async function bundle(
})
}
}
}
},
configFile: config.vite?.configFile
})
let clientResult!: Rollup.RollupOutput | null

@ -23,6 +23,7 @@ export async function createServer(
cacheDir: config.cacheDir,
plugins: await createVitePressPlugin(config, false, {}, {}, recreateServer),
server: serverOptions,
customLogger: config.logger
customLogger: config.logger,
configFile: config.vite?.configFile
})
}

@ -83,7 +83,7 @@ export interface UserConfig<ThemeConfig = any>
/**
* Vite config
*/
vite?: ViteConfig
vite?: ViteConfig & { configFile?: string | false }
/**
* Configure the scroll offset when the theme has a sticky header.

Loading…
Cancel
Save