Skip to content

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

Description

@bregenspan

rspack-resolver seems to have the same bug in restrictions handling that enhanced-resolve fixed here: webpack/enhanced-resolve#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): bregenspan@abaf51a

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions