From c77768772ca593abc1fd27508bcbb56bb7e7d393 Mon Sep 17 00:00:00 2001 From: Chang Wang Date: Sat, 10 Jul 2021 14:15:32 -0400 Subject: [PATCH] scoped portions of scoped packages aren't dependencies don't look for package.json under the "scope portion" of scoped packages e.g. `@react-aria/package.json` fix #43 --- src/licenseUtils.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/licenseUtils.js b/src/licenseUtils.js index 0b82190..c5674b5 100644 --- a/src/licenseUtils.js +++ b/src/licenseUtils.js @@ -58,6 +58,10 @@ const getLicenseInformationForCompilation = (compilation, filter) => { const fileDependencies = Array.from(compilation.fileDependencies); return fileDependencies.reduce((memo, dependencyPath) => { const match = dependencyPath.match(filter); + if (dependencyPath.match(/@[\w|-]+$/)) { + // don't try to find package.json for the "scope" portion of scoped packages e.g. "@react-aria/package.json" + return memo; + } if (match) { const [, rootPath, dependencyName] = match; memo[dependencyName] = getLicenseInformationForDependency(rootPath);