@@ -750,7 +750,7 @@ export class ResolverImplementation implements Resolver {
750
750
from,
751
751
importPath,
752
752
importedPackage : dependency ,
753
- subpath : sourceNamePathToFsPath ( parsedDirectImport . subpath ) ,
753
+ subpath : parsedDirectImport . subpath ,
754
754
} ) ;
755
755
}
756
756
@@ -1002,7 +1002,7 @@ export class ResolverImplementation implements Resolver {
1002
1002
* @param importedPackage The NpmPackage that is being imported.
1003
1003
* @param subpath The path to the file to import, within the
1004
1004
* package. That means, after parsing the direct import, and stripping the
1005
- * package part.
1005
+ * package part, before resolving package exports .
1006
1006
*/
1007
1007
async #resolveImportToNpmPackage( {
1008
1008
from,
@@ -1015,8 +1015,7 @@ export class ResolverImplementation implements Resolver {
1015
1015
importedPackage : ResolvedNpmPackage ;
1016
1016
subpath : string ;
1017
1017
} ) : Promise < NpmPackageResolvedFile > {
1018
- const sourceName =
1019
- importedPackage . rootSourceName + fsPathToSourceNamePath ( subpath ) ;
1018
+ const sourceName = importedPackage . rootSourceName + subpath ;
1020
1019
1021
1020
const existing = this . #resolvedFileBySourceName. get ( sourceName ) ;
1022
1021
if ( existing !== undefined ) {
@@ -1025,12 +1024,13 @@ export class ResolverImplementation implements Resolver {
1025
1024
return existing as NpmPackageResolvedFile ;
1026
1025
}
1027
1026
1027
+ // We use the subpath (pre-resolution) to create source names
1028
1028
const resolvedSubpath = resolveSubpath ( importedPackage , subpath ) ;
1029
1029
1030
1030
await this . #validateExistanceAndCasingOfImport( {
1031
1031
from,
1032
1032
importPath,
1033
- relativeFsPathToValidate : resolvedSubpath ,
1033
+ relativeFsPathToValidate : sourceNamePathToFsPath ( resolvedSubpath ) ,
1034
1034
absoluteFsPathToValidateFrom : importedPackage . rootFsPath ,
1035
1035
usingPackageExports : importedPackage . exports !== undefined ,
1036
1036
} ) ;
0 commit comments