rstackjs / rstackjs/rspack-resolver

`restrictions`: resolution of packages that have `exports` fields does not fall back correctly

Open
#267 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
42
Forks
10
Avg merge
3h
Merged PRs (30d)
1

Description

rspack-resolver seems to have the same bug in restrictions handling that enhanced-resolve fixed here: https://github.com/webpack/enhanced-resolve/pull/600. (An error is returned when attempting to resolve a package that has an exports field defined, instead of falling back to resolve from a subsequent entry in modules configuration.)

The case is the one described here: https://github.com/orgs/webpack/discussions/21080, where "modules" is configured as an array of two or more entries, and "restrictions" is defined in a way that means the first "modules" entry will produce a resolution that does not meet the restriction.

I do not know Rust, so ignore this is if it's not a helpful illustration, but here is a Claude-generated repro (porting the new test cases enhanced-resolve introduced for this issue, and highlighting the scenario that fails): https://github.com/bregenspan/rspack-resolver/commit/abaf51a5eeeca1c5ff029fbd270a6b632c959567

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the enhanced-resolve PR #600 and the linked repro commit, then trace rspack-resolver's restrictions handling for packages with exports and multiple modules entries. Add a regression test for the fallback scenario and verify that resolution proceeds to a later modules entry when the first result violates the restriction.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.