Skip to content

Commit

Permalink
fix(build): build project path error (#9793)
Browse files Browse the repository at this point in the history
  • Loading branch information
btea committed Aug 27, 2022
1 parent c3f6731 commit cc8800a
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions packages/vite/src/node/plugins/html.ts
Expand Up @@ -19,8 +19,7 @@ import {
isDataUrl,
isExternalUrl,
normalizePath,
processSrcSet,
slash
processSrcSet
} from '../utils'
import type { ResolvedConfig } from '../config'
import { toOutputFilePathInHtml } from '../build'
Expand Down Expand Up @@ -297,7 +296,10 @@ export function buildHtmlPlugin(config: ResolvedConfig): Plugin {

async transform(html, id) {
if (id.endsWith('.html')) {
const relativeUrlPath = slash(path.relative(config.root, id))
const relativeUrlPath = path.posix.relative(
config.root,
normalizePath(id)
)
const publicPath = `/${relativeUrlPath}`
const publicBase = getBaseInHTML(relativeUrlPath, config)

Expand Down Expand Up @@ -669,7 +671,10 @@ export function buildHtmlPlugin(config: ResolvedConfig): Plugin {
}

for (const [id, html] of processedHtml) {
const relativeUrlPath = path.posix.relative(config.root, id)
const relativeUrlPath = path.posix.relative(
config.root,
normalizePath(id)
)
const assetsBase = getBaseInHTML(relativeUrlPath, config)
const toOutputFilePath = (
filename: string,
Expand Down

0 comments on commit cc8800a

Please sign in to comment.