diff options
Diffstat (limited to 'packages/sol-resolver/src/resolvers')
-rw-r--r-- | packages/sol-resolver/src/resolvers/npm_resolver.ts | 2 | ||||
-rw-r--r-- | packages/sol-resolver/src/resolvers/relative_fs_resolver.ts | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/packages/sol-resolver/src/resolvers/npm_resolver.ts b/packages/sol-resolver/src/resolvers/npm_resolver.ts index 9f8617145..a2df0dcad 100644 --- a/packages/sol-resolver/src/resolvers/npm_resolver.ts +++ b/packages/sol-resolver/src/resolvers/npm_resolver.ts @@ -19,7 +19,7 @@ export class NPMResolver extends Resolver { const ROOT_PATH = '/'; while (currentPath !== ROOT_PATH) { const lookupPath = path.join(currentPath, 'node_modules', packageName, pathWithinPackage); - if (fs.existsSync(lookupPath)) { + if (fs.existsSync(lookupPath) && fs.lstatSync(lookupPath).isFile()) { const fileContent = fs.readFileSync(lookupPath).toString(); return { source: fileContent, diff --git a/packages/sol-resolver/src/resolvers/relative_fs_resolver.ts b/packages/sol-resolver/src/resolvers/relative_fs_resolver.ts index 77103b8c1..ed96040d3 100644 --- a/packages/sol-resolver/src/resolvers/relative_fs_resolver.ts +++ b/packages/sol-resolver/src/resolvers/relative_fs_resolver.ts @@ -14,7 +14,7 @@ export class RelativeFSResolver extends Resolver { // tslint:disable-next-line:prefer-function-over-method public resolveIfExists(importPath: string): ContractSource | undefined { const filePath = path.join(this._contractsDir, importPath); - if (fs.existsSync(filePath)) { + if (fs.existsSync(filePath) && !fs.lstatSync(filePath).isDirectory()) { const fileContent = fs.readFileSync(filePath).toString(); return { source: fileContent, |