Skip to content

Commit 10c43a8

Browse files
committed
Use the right path style when calling #resolveImportToNpmPackage
1 parent af1dee0 commit 10c43a8

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

v-next/hardhat/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ export class ResolverImplementation implements Resolver {
750750
from,
751751
importPath,
752752
importedPackage: dependency,
753-
subpath: sourceNamePathToFsPath(parsedDirectImport.subpath),
753+
subpath: parsedDirectImport.subpath,
754754
});
755755
}
756756

@@ -1002,7 +1002,7 @@ export class ResolverImplementation implements Resolver {
10021002
* @param importedPackage The NpmPackage that is being imported.
10031003
* @param subpath The path to the file to import, within the
10041004
* package. That means, after parsing the direct import, and stripping the
1005-
* package part.
1005+
* package part, before resolving package exports.
10061006
*/
10071007
async #resolveImportToNpmPackage({
10081008
from,
@@ -1015,8 +1015,7 @@ export class ResolverImplementation implements Resolver {
10151015
importedPackage: ResolvedNpmPackage;
10161016
subpath: string;
10171017
}): Promise<NpmPackageResolvedFile> {
1018-
const sourceName =
1019-
importedPackage.rootSourceName + fsPathToSourceNamePath(subpath);
1018+
const sourceName = importedPackage.rootSourceName + subpath;
10201019

10211020
const existing = this.#resolvedFileBySourceName.get(sourceName);
10221021
if (existing !== undefined) {
@@ -1025,12 +1024,13 @@ export class ResolverImplementation implements Resolver {
10251024
return existing as NpmPackageResolvedFile;
10261025
}
10271026

1027+
// We use the subpath (pre-resolution) to create source names
10281028
const resolvedSubpath = resolveSubpath(importedPackage, subpath);
10291029

10301030
await this.#validateExistanceAndCasingOfImport({
10311031
from,
10321032
importPath,
1033-
relativeFsPathToValidate: resolvedSubpath,
1033+
relativeFsPathToValidate: sourceNamePathToFsPath(resolvedSubpath),
10341034
absoluteFsPathToValidateFrom: importedPackage.rootFsPath,
10351035
usingPackageExports: importedPackage.exports !== undefined,
10361036
});

0 commit comments

Comments
 (0)