File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed
packages/vite/src/node/plugins Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -594,7 +594,9 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin {
594594
595595 const toRelative = ( filename : string ) => {
596596 // relative base + extracted CSS
597- const relativePath = path . posix . relative ( cssAssetDirname ! , filename )
597+ const relativePath = normalizePath (
598+ path . relative ( cssAssetDirname ! , filename ) ,
599+ )
598600 return relativePath [ 0 ] === '.' ? relativePath : './' + relativePath
599601 }
600602
@@ -615,9 +617,8 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin {
615617 } )
616618 // resolve public URL from CSS paths
617619 if ( encodedPublicUrls ) {
618- const relativePathToPublicFromCSS = path . posix . relative (
619- cssAssetDirname ! ,
620- '' ,
620+ const relativePathToPublicFromCSS = normalizePath (
621+ path . relative ( cssAssetDirname ! , '' ) ,
621622 )
622623 chunkCSS = chunkCSS . replace ( publicAssetUrlRE , ( _ , hash ) => {
623624 const publicUrl = publicAssetUrlMap . get ( hash ) ! . slice ( 1 )
Original file line number Diff line number Diff line change @@ -330,7 +330,7 @@ export function buildHtmlPlugin(config: ResolvedConfig): Plugin {
330330 async transform ( html , id ) {
331331 if ( id . endsWith ( '.html' ) ) {
332332 id = normalizePath ( id )
333- const relativeUrlPath = path . posix . relative ( config . root , id )
333+ const relativeUrlPath = normalizePath ( path . relative ( config . root , id ) )
334334 const publicPath = `/${ relativeUrlPath } `
335335 const publicBase = getBaseInHTML ( relativeUrlPath , config )
336336
@@ -776,7 +776,9 @@ export function buildHtmlPlugin(config: ResolvedConfig): Plugin {
776776 }
777777
778778 for ( const [ normalizedId , html ] of processedHtml ) {
779- const relativeUrlPath = path . posix . relative ( config . root , normalizedId )
779+ const relativeUrlPath = normalizePath (
780+ path . relative ( config . root , normalizedId ) ,
781+ )
780782 const assetsBase = getBaseInHTML ( relativeUrlPath , config )
781783 const toOutputFilePath = (
782784 filename : string ,
You can’t perform that action at this time.
0 commit comments