File tree 1 file changed +4
-3
lines changed 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) {
173
173
job . runSync ( ) ;
174
174
return cjsCache . get ( job . url ) . exports ;
175
175
} ;
176
- setOwnProperty ( require , 'resolve' , function resolve ( spec ) {
176
+ setOwnProperty ( requireFn , 'resolve' , function resolve ( spec ) {
177
177
// TODO: add support for absolute paths
178
178
if ( spec [ 0 ] === '.' ) {
179
179
spec = pathToFileURL ( join ( __dirname , spec ) ) ;
180
180
}
181
+ // TODO: make this work for CJSism (e.g. dir import, extensionless imports, etc.)
181
182
const { url : resolvedURL } = asyncESM . esmLoader . resolve ( spec , url ) ;
182
183
return StringPrototypeStartsWith ( resolvedURL , 'file://' ) ? fileURLToPath ( resolvedURL ) : resolvedURL ;
183
184
} ) ;
184
- setOwnProperty ( require , 'cache' , CJSModule . _cache ) ;
185
- setOwnProperty ( require , 'main' , process . mainModule ) ;
185
+ setOwnProperty ( requireFn , 'cache' , CJSModule . _cache ) ;
186
+ setOwnProperty ( requireFn , 'main' , process . mainModule ) ;
186
187
187
188
cjsCache . set ( url , module ) ;
188
189
ReflectApply ( compiledWrapper , module . exports ,
You can’t perform that action at this time.
0 commit comments