diff options
-rw-r--r-- | packages/sol-resolver/src/resolvers/npm_resolver.ts | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/packages/sol-resolver/src/resolvers/npm_resolver.ts b/packages/sol-resolver/src/resolvers/npm_resolver.ts index 6c7ebdcd1..eeb2b5493 100644 --- a/packages/sol-resolver/src/resolvers/npm_resolver.ts +++ b/packages/sol-resolver/src/resolvers/npm_resolver.ts @@ -17,8 +17,8 @@ export class NPMResolver extends Resolver { let packageName; let packageScopeIfExists; let other; - if (importPath.startsWith('@')) { - [packageScope, packageName, ...other] = importPath.split('/'); + if (_.startsWith(importPath, '@')) { + [packageScopeIfExists, packageName, ...other] = importPath.split('/'); } else { [packageName, ...other] = importPath.split('/'); } @@ -26,7 +26,9 @@ export class NPMResolver extends Resolver { let currentPath = this._packagePath; const ROOT_PATH = '/'; while (currentPath !== ROOT_PATH) { - const packagePath = _.isUndefined(packageScopeIfExists) ? packageName : path.join(packageScopeIfExists, packageName); + const packagePath = _.isUndefined(packageScopeIfExists) + ? packageName + : path.join(packageScopeIfExists, packageName); const lookupPath = path.join(currentPath, 'node_modules', packagePath, pathWithinPackage); if (fs.existsSync(lookupPath) && fs.lstatSync(lookupPath).isFile()) { const fileContent = fs.readFileSync(lookupPath).toString(); |