Skip to content

Commit 1bed154

Browse files
authored
feat(build): allow overriding vite config loading (#2750)
1 parent 0f421d7 commit 1bed154

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

src/node/build/bundle.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
normalizePath,
77
type BuildOptions,
88
type Rollup,
9-
type UserConfig as ViteUserConfig
9+
type InlineConfig as ViteInlineConfig
1010
} from 'vite'
1111
import { APP_PATH } from '../alias'
1212
import type { SiteConfig } from '../config'
@@ -50,7 +50,9 @@ export async function bundle(
5050
// resolve options to pass to vite
5151
const { rollupOptions } = options
5252

53-
const resolveViteConfig = async (ssr: boolean): Promise<ViteUserConfig> => ({
53+
const resolveViteConfig = async (
54+
ssr: boolean
55+
): Promise<ViteInlineConfig> => ({
5456
root: config.srcDir,
5557
cacheDir: config.cacheDir,
5658
base: config.site.base,
@@ -136,7 +138,8 @@ export async function bundle(
136138
})
137139
}
138140
}
139-
}
141+
},
142+
configFile: config.vite?.configFile
140143
})
141144

142145
let clientResult!: Rollup.RollupOutput | null

src/node/server.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export async function createServer(
2323
cacheDir: config.cacheDir,
2424
plugins: await createVitePressPlugin(config, false, {}, {}, recreateServer),
2525
server: serverOptions,
26-
customLogger: config.logger
26+
customLogger: config.logger,
27+
configFile: config.vite?.configFile
2728
})
2829
}

src/node/siteConfig.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export interface UserConfig<ThemeConfig = any>
8383
/**
8484
* Vite config
8585
*/
86-
vite?: ViteConfig
86+
vite?: ViteConfig & { configFile?: string | false }
8787

8888
/**
8989
* Configure the scroll offset when the theme has a sticky header.

0 commit comments

Comments
 (0)