Skip to content

Commit

Permalink
handle base option
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed May 16, 2020
1 parent 42bac42 commit 2f8ef43
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
}

Expand Down
1 change: 1 addition & 0 deletions src/build/bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 || {}
}
Expand Down

0 comments on commit 2f8ef43

Please sign in to comment.