Skip to content

test: sync enhanced-resolve#579 tsconfig paths fall-through#212

Merged
stormslowly merged 1 commit into
mainfrom
sync/enhanced-resolve-pr-579-tsconfig-paths-fallthrough
May 13, 2026
Merged

test: sync enhanced-resolve#579 tsconfig paths fall-through#212
stormslowly merged 1 commit into
mainfrom
sync/enhanced-resolve-pr-579-tsconfig-paths-fallthrough

Conversation

@stormslowly
Copy link
Copy Markdown
Collaborator

Summary

Sync the regression test from webpack/enhanced-resolve#579 (fixes webpack/webpack#20944).

When a tsconfig paths pattern matches a request but the mapped target does not exist on disk, resolution should fall through to normal node_modules lookup — 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 returns Ok(None) if none resolve, letting the outer pipeline continue with load_aliasrequire_barenode_modules resolution.

This PR adds the regression test only (no source changes).

Test plan

  • cargo test --all-features tsconfig_paths_scoped_pkg_fallthrough passes
  • All existing tsconfig tests still pass

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
Copilot AI review requested due to automatic review settings May 13, 2026 03:58
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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_fallthrough covering @* mapping fall-through for scoped packages.
  • Introduced a dedicated fixture case (scoped-pkg-fallthrough) with a tsconfig.json, a mapped local module, and a scoped package under node_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.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 13, 2026

Merging this PR will not alter performance

✅ 12 untouched benchmarks


Comparing sync/enhanced-resolve-pr-579-tsconfig-paths-fallthrough (02c51ef) with main (4574c84)

Open in CodSpeed

@stormslowly stormslowly enabled auto-merge (squash) May 13, 2026 06:35
@stormslowly stormslowly requested a review from hardfist May 13, 2026 07:29
@stormslowly stormslowly merged commit 8975e38 into main May 13, 2026
25 checks passed
@stormslowly stormslowly deleted the sync/enhanced-resolve-pr-579-tsconfig-paths-fallthrough branch May 13, 2026 07:40
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.

resolve.tsconfig path pattern "@*" incorrectly matches scoped npm packages

3 participants