@@ -86,11 +86,7 @@ async function buildPackage(outDir: string, isESMOnly: boolean): Promise<void> {
8686  if  ( isESMOnly )  { 
8787    packageJSON . exports  =  { } ; 
8888
89-     const  {  emittedTSFiles }  =  emitTSFiles ( { 
90-       outDir, 
91-       module : 'es2020' , 
92-       extension : '.js' , 
93-     } ) ; 
89+     const  {  emittedTSFiles }  =  emitTSFiles ( {  outDir,  extension : '.js'  } ) ; 
9490
9591    for  ( const  filepath  of  emittedTSFiles )  { 
9692      if  ( path . basename ( filepath )  ===  'index.js' )  { 
@@ -113,9 +109,10 @@ async function buildPackage(outDir: string, isESMOnly: boolean): Promise<void> {
113109    const  {  emittedTSFiles }  =  emitTSFiles ( { 
114110      outDir, 
115111      module : 'commonjs' , 
112+       moduleResolution : 'node10' , 
116113      extension : '.js' , 
117114    } ) ; 
118-     emitTSFiles ( {  outDir,  module :  'es2020' ,   extension : '.mjs'  } ) ; 
115+     emitTSFiles ( {  outDir,  extension : '.mjs'  } ) ; 
119116
120117    packageJSON . exports  =  { } ; 
121118    for  ( const  filepath  of  emittedTSFiles )  { 
@@ -142,18 +139,18 @@ async function buildPackage(outDir: string, isESMOnly: boolean): Promise<void> {
142139// Based on https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#getting-the-dts-from-a-javascript-file 
143140function  emitTSFiles ( options : { 
144141  outDir : string ; 
145-   module : string ; 
142+   module ?: string ; 
143+   moduleResolution ?: string ; 
146144  extension : string ; 
147145} ) : { 
148146  emittedTSFiles : ReadonlyArray < string > ; 
149147}  { 
150-   const  {  outDir ,  module ,  extension  }  =  options ; 
148+   const  {  extension ,  ... rest  }  =  options ; 
151149  const  tsOptions  =  readTSConfig ( { 
152-     module , 
150+     ... rest , 
153151    noEmit : false , 
154152    declaration : true , 
155-     declarationDir : outDir , 
156-     outDir, 
153+     declarationDir : rest . outDir , 
157154    listEmittedFiles : true , 
158155  } ) ; 
159156
0 commit comments