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> {
8787
8888 for ( const filepath of emittedTSFiles ) {
8989 if ( path . basename ( filepath ) === 'index.js' ) {
90- const relativePath = './' + path . relative ( './npmDist' , filepath ) ;
90+ const relativePath =
91+ './' + crossPlatformRelativePath ( './npmDist' , filepath ) ;
9192 packageJSON . exports [ path . dirname ( relativePath ) ] = relativePath ;
9293 }
9394 }
@@ -140,3 +141,11 @@ function emitTSFiles(options: {
140141 emittedTSFiles : tsResult . emittedFiles . sort ( ( a , b ) => a . localeCompare ( b ) ) ,
141142 } ;
142143}
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