Skip to content

Commit

Permalink
fix: fix base configuration causing local development errors
Browse files Browse the repository at this point in the history
  • Loading branch information
anncwb committed Jan 28, 2022
1 parent fd78151 commit 6deeead
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/core/src/htmlPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,16 @@ export function createPlugin(userOptions: UserOptions = {}): Plugin {
configureServer(server) {
server.middlewares.use(async (req, res, next) => {
const url = cleanUrl(req.url || '')

if (!htmlFilter(url) && url !== '/') {
const base = viteConfig.base
const excludeBaseUrl = url.replace(base, '/')
if (!htmlFilter(url) && excludeBaseUrl !== '/') {
return next()
}

try {
const htmlName = url === '/' ? DEFAULT_TEMPLATE : url.replace('/', '')
const htmlName =
excludeBaseUrl === '/' ? DEFAULT_TEMPLATE : url.replace('/', '')

const page = getPage(userOptions, htmlName, viteConfig)
const { injectOptions = {} } = page
let html = await getHtmlInPages(page, viteConfig.root)
Expand Down

0 comments on commit 6deeead

Please sign in to comment.