handle base option

pull/18/head
Evan You 5 years ago
parent 42bac424fe
commit 2f8ef43da5

@ -60,7 +60,7 @@ export function createApp() {
const useLeanBuild = isInitialPageLoad || initialPath === pagePath const useLeanBuild = isInitialPageLoad || initialPath === pagePath
pagePath = pagePath =
(inBrowser ? __BASE__ + '_assets/' : './') + (inBrowser ? __BASE__ + '_assets/' : './') +
pagePath.slice(1).replace(/\//g, '_') + pagePath.slice(inBrowser ? __BASE__.length : 1).replace(/\//g, '_') +
(useLeanBuild ? '.md.lean.js' : '.md.js') (useLeanBuild ? '.md.lean.js' : '.md.js')
} }

@ -85,6 +85,7 @@ export async function bundle(
const { rollupInputOptions = {}, rollupOutputOptions = {} } = options const { rollupInputOptions = {}, rollupOutputOptions = {} } = options
const viteOptions: ViteBuildOptions = { const viteOptions: ViteBuildOptions = {
...options, ...options,
base: config.site.base,
resolvers: [resolver], resolvers: [resolver],
outDir: config.outDir, outDir: config.outDir,
assetsDir: ASSETS_DIR, assetsDir: ASSETS_DIR,

@ -91,7 +91,7 @@ export async function resolveSiteData(root: string): Promise<SiteData> {
return { return {
title: userConfig.title || 'VitePress', title: userConfig.title || 'VitePress',
description: userConfig.description || 'A VitePress site', description: userConfig.description || 'A VitePress site',
base: userConfig.base || '/', base: userConfig.base ? userConfig.base.replace(/([^/])$/, '$1/') : '/',
head: userConfig.head || [], head: userConfig.head || [],
themeConfig: userConfig.themeConfig || {} themeConfig: userConfig.themeConfig || {}
} }

Loading…
Cancel
Save