Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add base to virtual html #16442

Merged
merged 2 commits into from
Apr 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/vite/src/node/server/middlewares/indexHtml.ts
Expand Up @@ -191,7 +191,7 @@ const devHtmlHook: IndexHtmlTransformHook = async (
const trailingSlash = htmlPath.endsWith('/')
if (!trailingSlash && getFsUtils(config).existsSync(filename)) {
proxyModulePath = htmlPath
proxyModuleUrl = joinUrlSegments(base, htmlPath)
proxyModuleUrl = proxyModulePath
} else {
// There are users of vite.transformIndexHtml calling it with url '/'
// for SSR integrations #7993, filename is root for this case
Expand All @@ -202,6 +202,7 @@ const devHtmlHook: IndexHtmlTransformHook = async (
proxyModulePath = `\0${validPath}`
proxyModuleUrl = wrapId(proxyModulePath)
}
proxyModuleUrl = joinUrlSegments(base, proxyModuleUrl)

const s = new MagicString(html)
let inlineModuleIndex = -1
Expand Down