Skip to content

[Bug]: resolve.dedupe should support exports fields #5311

Description

@SoonIter

Version

@rsbuild/core 1.3.21

Details

"The alias expanded to an absolute path does not respect exports field."

  1. config like this
// rsbuild.config.ts
resolve: {
   dedupe: ['@tt/web']
}

Add the following two aliases to rspack:

// rspack.config.ts(Rsbuild actually generated)
resolve: {
   alias: {
     "@tt/web$": '/usr/demos/rsbuild/node_modules/.pnpm/@tt+web@1.0.19/@tt/web',
     "@tt/web/*": '/usr/demos/rsbuild/node_modules/.pnpm/@tt+web@1.0.19/node_modules/@tt/web' 
   }
}

If the user writes as below

import foo from "@tt/web/canary" 

it is actually equal to

import foo from "/usr/demos/rsbuild/node_modules/.pnpm/@tt+web@1.0.19/node_modules/@tt/web/canary"

At this moment, if the exports of @tt/web are written like this:

// @tt/web/package.json
exports: {
   "./canary": "./dist/canary.js"
}

Error: resolve not found

Reproduce link

none

Reproduce Steps

none

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions