Skip to content

fix(TsconfigPathsPlugin): give references priority over main paths#552

Merged
alexander-akait merged 3 commits intomainfrom
claude/tsconfig-references-priority-Yjcwc
Apr 22, 2026
Merged

fix(TsconfigPathsPlugin): give references priority over main paths#552
alexander-akait merged 3 commits intomainfrom
claude/tsconfig-references-priority-Yjcwc

Conversation

@alexander-akait
Copy link
Copy Markdown
Member

When the main tsconfig defines an alias that is also declared by a
referenced project, the reference's mapping should win. Previously
_selectPathsDataForContext returned only the main context's own
paths for requests against the main context, so referenced aliases
were never consulted in the conflict case.

Now, when refs exist, the main context's alias list is materialised
as [...refAliases, ...mainOwnAliases]. forEachBail in
aliasResolveHandler therefore checks references first and only
falls back to main paths when no reference alias matches. Modules
(baseUrl candidates) stay scoped to each context so per-reference
baseUrl resolution is unaffected.

claude added 3 commits April 22, 2026 20:46
When the main tsconfig defines an alias that is also declared by a
referenced project, the reference's mapping should win. Previously
`_selectPathsDataForContext` returned only the main context's own
paths for requests against the main context, so referenced aliases
were never consulted in the conflict case.

Now, when refs exist, the main context's alias list is materialised
as `[...refAliases, ...mainOwnAliases]`. `forEachBail` in
`aliasResolveHandler` therefore checks references first and only
falls back to main paths when no reference alias matches. Modules
(baseUrl candidates) stay scoped to each context so per-reference
baseUrl resolution is unaffected.
Adds a conflict fixture where main and a referenced project both
declare "@lib/*" but point at different targets. The new tests
assert:

- Resolving @lib/foo from the main context uses main's target.
- Resolving @lib/foo from the reference's directory uses the
  reference's target.
- The reference's target does not leak into main-context lookups.

This matches how tsc resolves paths — strictly through the tsconfig
that owns the importing file, with no merging across a references
edge.
@linux-foundation-easycla
Copy link
Copy Markdown

CLA Not Signed

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 22, 2026

⚠️ No Changeset found

Latest commit: 1dd9f0d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.60%. Comparing base (8757f67) to head (1dd9f0d).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #552      +/-   ##
==========================================
+ Coverage   96.57%   96.60%   +0.03%     
==========================================
  Files          50       50              
  Lines        2800     2800              
  Branches      863      863              
==========================================
+ Hits         2704     2705       +1     
+ Misses         80       79       -1     
  Partials       16       16              
Flag Coverage Δ
integration 96.60% <ø> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 22, 2026

Merging this PR will not alter performance

✅ 69 untouched benchmarks


Comparing claude/tsconfig-references-priority-Yjcwc (1dd9f0d) with main (e82275d)

Open in CodSpeed

@alexander-akait alexander-akait merged commit faa178f into main Apr 22, 2026
33 of 34 checks passed
@alexander-akait alexander-akait deleted the claude/tsconfig-references-priority-Yjcwc branch April 22, 2026 21:30
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.

2 participants