handle base option

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

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

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

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

Loading…
Cancel
Save