diff --git a/package.json b/package.json index 11a5e35..5b715bc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "remnants", - "version": "1.2.0", + "version": "1.2.1", "description": "Find unused files. Spot these residues, leftovers, relics of an ancient past.", "main": "index.js", "module": "src/index.js", diff --git a/src/resolver/index.js b/src/resolver/index.js index 602a010..60cfed3 100644 --- a/src/resolver/index.js +++ b/src/resolver/index.js @@ -57,7 +57,10 @@ const findImports = filePaths => filePaths.map((filePath) => { if (found[1][0] === '.') { founds.push(found[1]); } else { - usedDependencies[found[1]] = true; + const splits = found[1].split('/'); + usedDependencies[ + found[1][0] === '@' ? splits.slice(0, 2).join('/') : splits[0] + ] = true; } found = importRegex.exec(content); } @@ -66,7 +69,10 @@ const findImports = filePaths => filePaths.map((filePath) => { if (found[1][0] === '.') { founds.push(found[1]); } else { - usedDependencies[found[1]] = true; + const splits = found[1].split('/'); + usedDependencies[ + found[1][0] === '@' ? splits.slice(0, 2).join('/') : splits[0] + ] = true; } found = requireRegex.exec(content); }