test: sync enhanced-resolve#579 tsconfig paths fall-through#212
Merged
stormslowly merged 1 commit intoMay 13, 2026
Merged
Conversation
When a tsconfig `paths` pattern (e.g. `"@*": ["./src/*"]`) matches a request like `@sentry/react` but the mapped path does not exist on disk, resolution must fall through to normal node_modules lookup. This matches TypeScript's native behavior and was fixed upstream in webpack/enhanced-resolve#579. rspack-resolver already handles this correctly (the architecture in `load_tsconfig_paths` iterates candidates and returns `Ok(None)` on miss, letting the outer pipeline continue with alias and bare module resolution). This commit adds the regression test only — no source changes. Refs: webpack/enhanced-resolve#579 Refs: webpack/webpack#20944
Contributor
There was a problem hiding this comment.
Pull request overview
This PR syncs a regression test from enhanced-resolve to ensure TypeScript tsconfig.paths behavior matches TypeScript: if a paths mapping matches a specifier but none of the mapped targets exist, resolution should fall through to normal node_modules lookup.
Changes:
- Added a new async test
tsconfig_paths_scoped_pkg_fallthroughcovering@*mapping fall-through for scoped packages. - Introduced a dedicated fixture case (
scoped-pkg-fallthrough) with atsconfig.json, a mapped local module, and a scoped package undernode_modules.
Reviewed changes
Copilot reviewed 3 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/tests/tsconfig_paths.rs | Adds regression test asserting paths fall-through to node_modules when mapped targets don’t exist. |
| fixtures/tsconfig/cases/scoped-pkg-fallthrough/tsconfig.json | Defines baseUrl + paths mapping ("@*": ["./src/*"]) to reproduce the scenario. |
| fixtures/tsconfig/cases/scoped-pkg-fallthrough/src/helper/index.ts | Provides a resolvable mapped target for @helper. |
| fixtures/tsconfig/cases/scoped-pkg-fallthrough/node_modules/@sentry/react/package.json | Minimal scoped package metadata for node_modules resolution. |
| fixtures/tsconfig/cases/scoped-pkg-fallthrough/node_modules/@sentry/react/index.js | Minimal entry file for the scoped package resolution target. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
hardfist
approved these changes
May 13, 2026
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.
Summary
Sync the regression test from webpack/enhanced-resolve#579 (fixes webpack/webpack#20944).
When a tsconfig
pathspattern matches a request but the mapped target does not exist on disk, resolution should fall through to normalnode_moduleslookup — matching TypeScript's native behavior.Investigation
rspack-resolver is not affected by this bug. The architecture in
load_tsconfig_paths(src/lib.rs) iterates every candidate path and returnsOk(None)if none resolve, letting the outer pipeline continue withload_alias→require_bare→node_modulesresolution.This PR adds the regression test only (no source changes).
Test plan
cargo test --all-features tsconfig_paths_scoped_pkg_fallthroughpasses