@@ -347,11 +347,8 @@ function finalizeResolution(resolved, base) {
347
347
resolved . pathname , 'must not include encoded "/" or "\\" characters' ,
348
348
fileURLToPath ( base ) ) ;
349
349
350
- const file = resolveReplacementExtensions ( resolved ) || resolved ;
351
-
352
- const path = fileURLToPath ( file ) ;
353
-
354
350
if ( getOptionValue ( '--experimental-specifier-resolution' ) === 'node' ) {
351
+ const path = fileURLToPath ( resolved ) ;
355
352
let file = resolveExtensionsWithTryExactName ( resolved ) ;
356
353
if ( file !== undefined ) return file ;
357
354
if ( ! StringPrototypeEndsWith ( path , '/' ) ) {
@@ -364,6 +361,9 @@ function finalizeResolution(resolved, base) {
364
361
resolved . pathname , fileURLToPath ( base ) , 'module' ) ;
365
362
}
366
363
364
+ const file = resolveReplacementExtensions ( resolved ) || resolved ;
365
+ const path = fileURLToPath ( file ) ;
366
+
367
367
const stats = tryStatSync ( StringPrototypeEndsWith ( path , '/' ) ?
368
368
StringPrototypeSlice ( path , - 1 ) : path ) ;
369
369
if ( stats . isDirectory ( ) ) {
@@ -375,7 +375,7 @@ function finalizeResolution(resolved, base) {
375
375
path || resolved . pathname , fileURLToPath ( base ) , 'module' ) ;
376
376
}
377
377
378
- return resolved ;
378
+ return file ;
379
379
}
380
380
381
381
function throwImportNotDefined ( specifier , packageJSONUrl , base ) {
0 commit comments