File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -173,16 +173,17 @@ function createCJSModuleWrap(url, source) {
173173      job . runSync ( ) ; 
174174      return  cjsCache . get ( job . url ) . exports ; 
175175    } ; 
176-     setOwnProperty ( require ,  'resolve' ,  function  resolve ( spec )  { 
176+     setOwnProperty ( requireFn ,  'resolve' ,  function  resolve ( spec )  { 
177177      // TODO: add support for absolute paths 
178178      if  ( spec [ 0 ]  ===  '.' )  { 
179179        spec  =  pathToFileURL ( join ( __dirname ,  spec ) ) ; 
180180      } 
181+       // TODO: make this work for CJSism (e.g. dir import, extensionless imports, etc.) 
181182      const  {  url : resolvedURL  }  =  asyncESM . esmLoader . resolve ( spec ,  url ) ; 
182183      return  StringPrototypeStartsWith ( resolvedURL ,  'file://' )  ? fileURLToPath ( resolvedURL )  : resolvedURL ; 
183184    } ) ; 
184-     setOwnProperty ( require ,  'cache' ,  CJSModule . _cache ) ; 
185-     setOwnProperty ( require ,  'main' ,  process . mainModule ) ; 
185+     setOwnProperty ( requireFn ,  'cache' ,  CJSModule . _cache ) ; 
186+     setOwnProperty ( requireFn ,  'main' ,  process . mainModule ) ; 
186187
187188    cjsCache . set ( url ,  module ) ; 
188189    ReflectApply ( compiledWrapper ,  module . exports , 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments