Skip to content

Commit

Permalink
fix: build path error on Windows (#7383)
Browse files Browse the repository at this point in the history
  • Loading branch information
j-maas committed Mar 29, 2022
1 parent 4ffd82d commit e3c7c7a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/vite/src/node/plugins/html.ts
Expand Up @@ -594,7 +594,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 @@ -612,8 +611,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 @@ -628,6 +628,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

0 comments on commit e3c7c7a

Please sign in to comment.