fix(providence): resolve scoped packages outside node_modules
This commit is contained in:
parent
6c5b89c06f
commit
9f8826a3fa
2 changed files with 12 additions and 1 deletions
5
.changeset/old-lamps-clean.md
Normal file
5
.changeset/old-lamps-clean.md
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'providence-analytics': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
resolve scoped packages outside node_modules
|
||||||
|
|
@ -38,7 +38,13 @@ export async function fromImportToExportPerspective({ importee, importer, import
|
||||||
}
|
}
|
||||||
|
|
||||||
const absolutePath = await resolveImportPath(importee, importer, {
|
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) {
|
if (!absolutePath) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue