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: build path error on Windows #7383

Merged
merged 2 commits into from Mar 29, 2022
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
5 changes: 3 additions & 2 deletions packages/vite/src/node/plugins/html.ts
Expand Up @@ -588,7 +588,6 @@ export function buildHtmlPlugin(config: ResolvedConfig): Plugin {
}
}

const shortEmitName = path.posix.relative(config.root, id)
// no use assets plugin because it will emit file
let match: RegExpExecArray | null
let s: MagicString | undefined
Expand All @@ -605,8 +604,9 @@ export function buildHtmlPlugin(config: ResolvedConfig): Plugin {
if (s) {
result = s.toString()
}
const relativeUrlPath = path.posix.relative(config.root, id)
result = await applyHtmlTransforms(result, postHooks, {
path: '/' + shortEmitName,
path: '/' + relativeUrlPath,
filename: id,
bundle,
chunk
Expand All @@ -621,6 +621,7 @@ export function buildHtmlPlugin(config: ResolvedConfig): Plugin {
delete bundle[chunk.fileName]
}

const shortEmitName = path.relative(config.root, id)
this.emitFile({
type: 'asset',
fileName: shortEmitName,
Expand Down