diff --git a/.changeset/old-lamps-clean.md b/.changeset/old-lamps-clean.md new file mode 100644 index 000000000..d7d6a5b91 --- /dev/null +++ b/.changeset/old-lamps-clean.md @@ -0,0 +1,5 @@ +--- +'providence-analytics': patch +--- + +resolve scoped packages outside node_modules diff --git a/packages-node/providence-analytics/src/program/utils/from-import-to-export-perspective.js b/packages-node/providence-analytics/src/program/utils/from-import-to-export-perspective.js index 9ab8ade90..efc2519d2 100644 --- a/packages-node/providence-analytics/src/program/utils/from-import-to-export-perspective.js +++ b/packages-node/providence-analytics/src/program/utils/from-import-to-export-perspective.js @@ -38,7 +38,13 @@ export async function fromImportToExportPerspective({ importee, importer, import } const absolutePath = await resolveImportPath(importee, importer, { - modulePaths: [path.resolve(importeeProjectPath, '..')], + // Usually, we resolve from `{importer}/node_modules`. + // In some contexts, the package we are looking for is not in the importer's node_modules. + // In that case it is either 2 levels (in cases of a scoped package) up or 1 level up. + modulePaths: [ + path.resolve(importeeProjectPath, '..'), + path.resolve(importeeProjectPath, '../..'), + ], }); if (!absolutePath) {