File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,26 @@ export function baseConfig(options: {
6060          packageJson . types  =  packageJson . types . replace ( / ^ d i s t \/ / ,  '' ) ; 
6161        } 
6262
63+         // Update bin field to use correct extension for built files 
64+         if  ( packageJson . bin )  { 
65+           if  ( typeof  packageJson . bin  ===  'string' )  { 
66+             // Single bin entry 
67+             packageJson . bin  =  packageJson . bin 
68+               . replace ( / ^ d i s t \/ / ,  '' ) 
69+               . replace ( / \. j s $ / ,  '.mjs' ) ; 
70+           }  else  { 
71+             // Multiple bin entries 
72+             packageJson . bin  =  Object . fromEntries ( 
73+               Object . entries ( packageJson . bin ) . map ( ( [ name ,  path ] )  =>  [ 
74+                 name , 
75+                 ( path  as  string ) 
76+                   . replace ( / ^ d i s t \/ / ,  '' ) 
77+                   . replace ( / \. j s $ / ,  '.mjs' ) , 
78+               ] ) , 
79+             ) ; 
80+           } 
81+         } 
82+ 
6383        // Generate exports field for dual ESM/CJS support 
6484        packageJson . exports  =  { 
6585          '.' : { 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments