File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -87,7 +87,8 @@ async function buildPackage(outDir: string): Promise<void> {
87
87
88
88
for ( const filepath of emittedTSFiles ) {
89
89
if ( path . basename ( filepath ) === 'index.js' ) {
90
- const relativePath = './' + path . relative ( './npmDist' , filepath ) ;
90
+ const relativePath =
91
+ './' + crossPlatformRelativePath ( './npmDist' , filepath ) ;
91
92
packageJSON . exports [ path . dirname ( relativePath ) ] = relativePath ;
92
93
}
93
94
}
@@ -140,3 +141,11 @@ function emitTSFiles(options: {
140
141
emittedTSFiles : tsResult . emittedFiles . sort ( ( a , b ) => a . localeCompare ( b ) ) ,
141
142
} ;
142
143
}
144
+
145
+ function crossPlatformRelativePath ( from : string , to : string ) : string {
146
+ const relativePath = path . relative ( from , to ) ;
147
+ if ( process . platform !== 'win32' ) {
148
+ return relativePath ;
149
+ }
150
+ return path . posix . format ( { ...path . parse ( relativePath ) , root : '' } ) ;
151
+ }
You can’t perform that action at this time.
0 commit comments