@@ -25,6 +25,10 @@ export default function typescript(options: RollupTypescriptOptions = {}): Plugi
25
25
26
26
let program : import ( 'typescript' ) . Watch < unknown > | null = null ;
27
27
28
+ function normalizePath ( fileName : string ) {
29
+ return fileName . split ( path . win32 . sep ) . join ( path . posix . sep ) ;
30
+ }
31
+
28
32
return {
29
33
name : 'typescript' ,
30
34
@@ -62,7 +66,7 @@ export default function typescript(options: RollupTypescriptOptions = {}): Plugi
62
66
if ( ! importer ) return null ;
63
67
64
68
// Convert path from windows separators to posix separators
65
- const containingFile = importer . split ( path . win32 . sep ) . join ( path . posix . sep ) ;
69
+ const containingFile = normalizePath ( importer ) ;
66
70
67
71
const resolved = resolveModule ( importee , containingFile ) ;
68
72
@@ -89,7 +93,7 @@ export default function typescript(options: RollupTypescriptOptions = {}): Plugi
89
93
if ( code ) {
90
94
this . emitFile ( {
91
95
type : 'asset' ,
92
- fileName : path . relative ( outputOptions . dir ! , id ) ,
96
+ fileName : normalizePath ( path . relative ( outputOptions . dir ! , id ) ) ,
93
97
source : code
94
98
} ) ;
95
99
}
@@ -99,7 +103,7 @@ export default function typescript(options: RollupTypescriptOptions = {}): Plugi
99
103
if ( tsBuildInfoPath ) {
100
104
this . emitFile ( {
101
105
type : 'asset' ,
102
- fileName : path . relative ( outputOptions . dir ! , tsBuildInfoPath ) ,
106
+ fileName : normalizePath ( path . relative ( outputOptions . dir ! , tsBuildInfoPath ) ) ,
103
107
source : emittedFiles . get ( tsBuildInfoPath )
104
108
} ) ;
105
109
}
0 commit comments