File tree Expand file tree Collapse file tree
packages/vite/src/node/plugins Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,8 +19,7 @@ import {
1919 isDataUrl ,
2020 isExternalUrl ,
2121 normalizePath ,
22- processSrcSet ,
23- slash
22+ processSrcSet
2423} from '../utils'
2524import type { ResolvedConfig } from '../config'
2625import { toOutputFilePathInHtml } from '../build'
@@ -297,7 +296,10 @@ export function buildHtmlPlugin(config: ResolvedConfig): Plugin {
297296
298297 async transform ( html , id ) {
299298 if ( id . endsWith ( '.html' ) ) {
300- const relativeUrlPath = slash ( path . relative ( config . root , id ) )
299+ const relativeUrlPath = path . posix . relative (
300+ config . root ,
301+ normalizePath ( id )
302+ )
301303 const publicPath = `/${ relativeUrlPath } `
302304 const publicBase = getBaseInHTML ( relativeUrlPath , config )
303305
@@ -669,7 +671,10 @@ export function buildHtmlPlugin(config: ResolvedConfig): Plugin {
669671 }
670672
671673 for ( const [ id , html ] of processedHtml ) {
672- const relativeUrlPath = path . posix . relative ( config . root , id )
674+ const relativeUrlPath = path . posix . relative (
675+ config . root ,
676+ normalizePath ( id )
677+ )
673678 const assetsBase = getBaseInHTML ( relativeUrlPath , config )
674679 const toOutputFilePath = (
675680 filename : string ,
You can’t perform that action at this time.
0 commit comments