Skip to content

fix(graph): resolve Vue paths aliases against the declaring tsconfig without baseUrl - #268

Merged
adityankale190895 merged 1 commit into
DiffCI:mainfrom
FredApps:fix/vue-alias-paths-base
Nov 18, 2026
Merged

adityankale190895 merged 1 commit into
DiffCI:mainfrom
FredApps:fix/vue-alias-paths-base

Conversation

@FredApps

Copy link
Copy Markdown
Contributor

Fixes #267

.vue candidates from paths are now resolved against baseUrl, then the declaring tsconfig's directory (pathsBasePath), and only then the importer's directory. Root-alias resolution is unchanged.

The solution-style layout (paths only in a referenced tsconfig.app.json) is not covered and still falls back.

Validation:

  • tests/repo/vue-alias-paths-base.test.ts: root and nested tsconfig without baseUrl fail on main and pass here. The baseUrl case passes on both.
  • npm run typecheck, npm test (1170 pass), npm run build, npm run audit:boundary.

…ctory

A .vue specifier is resolved by findAssetCandidate so the edge reaches the SFC, not a declaration shim. Without baseUrl its alias root was the importer's directory, but TypeScript resolves paths against the declaring tsconfig (pathsBasePath). @/components/A.vue under paths { "@/*": ["./src/*"] } was never found and every change fell back with "Unresolved Vue dependencies". Root aliases now resolve from the root baseUrl or the repository root, as for assets.

Signed-off-by: FredApps <[email protected]>

@FredApps FredApps left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cross-review of 1bd1d17.

Checked:

  • The fix matches #267. With the importer's own paths, the .vue lookup now resolves against baseUrl or TypeScript's pathsBasePath, as resolvePatternTargets already does. Without them it resolves the root aliases from the repository root (or the root baseUrl) instead of the importer's directory.
  • The new test fails with src/ reverted (2 of 3 fail) and passes with the fix. tests/repo/vue-alias-paths-base.test.ts is listed in release-files.json. The commit is DCO-signed. The branch is level with main. CI is green.

Fixed: nothing.

Still open (minor, not blocking): the comment says root aliases resolve "as for assets". The asset lookup further down passes repoPath with no baseUrl, so the two differ when the root tsconfig sets a baseUrl other than .. In a Vue-scoped package, profile.pathAliases already carry the package prefix, so applying the root baseUrl on top could miss. A miss there keeps the existing "Unresolved Vue dependencies" fallback, so it stays safe.

@FredApps
FredApps marked this pull request as ready for review November 18, 2026 00:56
@adityankale190895
adityankale190895 merged commit b00a1d9 into DiffCI:main Nov 18, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vue: tsconfig paths without baseUrl resolve against the importer, so aliased .vue imports always fall back

2 participants