fix: resolve aliases from referenced tsconfig projects in sibling directories#216
Open
benpsnyder wants to merge 1 commit into
Open
fix: resolve aliases from referenced tsconfig projects in sibling directories#216benpsnyder wants to merge 1 commit into
benpsnyder wants to merge 1 commit into
Conversation
…ectories When a root tsconfig uses project references, the referenced configs may live in sibling directories (e.g., .nuxt/, .config/) that are never visited by the ancestor directory walk in getResolvers. This caused imports using aliases defined in referenced projects to fail with configMismatch when the importer was outside the reference's directory. Two changes: 1. getResolvers now yields unrestricted resolvers from referenced projects when visiting the parent directory 2. createResolver accepts skipIncludeCheck for referenced resolvers, since the parent project's scope applies rather than the reference's narrow include patterns Fixes aleclarson#190.
benpsnyder
force-pushed
the
fix/referenced-project-resolution
branch
from
March 29, 2026 20:51
61f3342 to
8ef75a9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #190.
Summary
When a root tsconfig uses project references (e.g., Nuxt, shared config packages), the referenced configs may live in sibling directories (
.nuxt/,.config/) that are never visited by the ancestor directory walk ingetResolvers. Imports using aliases defined in those referenced projects fail withconfigMismatch.Example: Nuxt generates
.nuxt/tsconfig.app.jsonwith path aliases like@: ["../app"]. A file attests/mytest.tsimporting@/somethingfails because:tests/goes up to the project roottsconfig.jsonhas"files": []— skipped (no resolver created).nuxt/tsconfig.app.jsonis stored under.nuxt/in the cache — never visitedChanges
getResolvers— when visiting a directory, also yield resolvers from referenced projects. This surfaces aliases from sibling directories without changing the walk itself.createResolver— accepts askipIncludeCheckflag. Referenced resolvers skip the include/exclude check since the parent project's scope applies rather than the reference's narrow include patterns (which typically only cover its own source files).src/resolver.tsgetResolversyields referenced resolvers;createResolversupportsskipIncludeCheck;unrestrictedResolversByProjectWeakMaptest/__fixtures__/referenced-sibling/files: []referencing.config/tsconfig.app.jsonthat defines@/*pathsTest plan
referenced-siblingfixture passes (both tsc and Vite build).nuxt/tsconfig.app.jsonreferences