File tree 2 files changed +9
-6
lines changed
packages/vite/src/node/plugins
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 {
594
594
595
595
const toRelative = ( filename : string ) => {
596
596
// relative base + extracted CSS
597
- const relativePath = path . posix . relative ( cssAssetDirname ! , filename )
597
+ const relativePath = normalizePath (
598
+ path . relative ( cssAssetDirname ! , filename ) ,
599
+ )
598
600
return relativePath [ 0 ] === '.' ? relativePath : './' + relativePath
599
601
}
600
602
@@ -615,9 +617,8 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin {
615
617
} )
616
618
// resolve public URL from CSS paths
617
619
if ( encodedPublicUrls ) {
618
- const relativePathToPublicFromCSS = path . posix . relative (
619
- cssAssetDirname ! ,
620
- '' ,
620
+ const relativePathToPublicFromCSS = normalizePath (
621
+ path . relative ( cssAssetDirname ! , '' ) ,
621
622
)
622
623
chunkCSS = chunkCSS . replace ( publicAssetUrlRE , ( _ , hash ) => {
623
624
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 {
330
330
async transform ( html , id ) {
331
331
if ( id . endsWith ( '.html' ) ) {
332
332
id = normalizePath ( id )
333
- const relativeUrlPath = path . posix . relative ( config . root , id )
333
+ const relativeUrlPath = normalizePath ( path . relative ( config . root , id ) )
334
334
const publicPath = `/${ relativeUrlPath } `
335
335
const publicBase = getBaseInHTML ( relativeUrlPath , config )
336
336
@@ -776,7 +776,9 @@ export function buildHtmlPlugin(config: ResolvedConfig): Plugin {
776
776
}
777
777
778
778
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
+ )
780
782
const assetsBase = getBaseInHTML ( relativeUrlPath , config )
781
783
const toOutputFilePath = (
782
784
filename : string ,
You can’t perform that action at this time.
0 commit comments