You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
npm/yarn workspaces not detected for import resolution (only pnpm-workspace.yaml) #1334
Following up on #1317 (thanks again for the fast v0.8.40 turnaround).
Observation. graphify resolves workspace-package imports well: entry via exports/main/module/src/index, subpaths, and tsconfig path aliases. That resolution only happens once a repo is recognized as a workspace, and _find_workspace_root (extract.py) detects a workspace only via pnpm-workspace.yaml. npm and yarn monorepos instead declare members in the package.json"workspaces" field (a string array, or the { "packages": [...] } object form). For those repos the workspace-resolution path never fires, so sibling-package imports like import x from '@acme/common' stay unresolved/external.
Repro. An npm-workspaces monorepo (root package.json with "workspaces": ["packages/*"], no pnpm-workspace.yaml); a cross-package @scope/pkg import does not resolve to the member's entry file.
Proposed fix (small, additive). Recognize npm/yarn "workspaces" as a workspace marker: have _find_workspace_root also treat a package.json containing "workspaces" as a root, and _workspace_globs read member globs from it (array form plus the {packages:[]} form). Everything downstream (_resolve_workspace_import, entry resolution) is reused unchanged; this just lets the existing machinery fire for npm/yarn. Deterministic, 0-token, and it only resolves previously-dangling imports.
Happy to open a PR with tests (npm array form, yarn object form, pnpm regression) if you are open to it.
Activity
fix js workspace import resolution (Graphify-Labs#1352)
fix js workspace import resolution (Graphify-Labs#1352)