Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

newResolver doesn't use browser field as expected #4933

Closed
JohnDaly opened this issue Dec 6, 2023 · 2 comments
Closed

newResolver doesn't use browser field as expected #4933

JohnDaly opened this issue Dec 6, 2023 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@JohnDaly
Copy link

JohnDaly commented Dec 6, 2023

System Info

System:
OS: macOS 12.4
CPU: (10) arm64 Apple M1 Max
Memory: 22.38 GB / 64.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 20.5.0 - ~/Library/Caches/fnm_multishells/61564_1700104358947/bin/node
Yarn: 1.22.17 - ~/.yarn/bin/yarn
npm: 9.8.0 - ~/Library/Caches/fnm_multishells/61564_1700104358947/bin/npm
pnpm: 8.10.5 - ~/Library/Caches/fnm_multishells/61564_1700104358947/bin/pnpm
bun: 0.8.1 - ~/.bun/bin/bun
Browsers:
Chrome: 119.0.6045.105
Safari: 15.5

Details

Enabling the 'newResolver' feature causes build failures when importing packages that use the browser field in package.json to avoid importing code intended for Node.js.

As an example, this is what the package.json looks like in the vscode-languageserver package:
https://github.com/microsoft/vscode-languageserver-node/blob/4812428a8621dff4153282407fc71494b994eda3/server/package.json#L15-L18

When building with Webpack, the browser field is respected, and we don't get any files from the lib/node directory.

When building with rspack, we end up with files from the lib/node directory, which causes errors.

This is probably related to #4446

Reproduce link

https://github.com/JohnDaly/rspack-new-resolver-browser-alias-bug

Reproduce Steps

  1. run pnpm run build:rspack
  2. notice the error[internal]: Resolve error errors in the terminal
@JohnDaly JohnDaly added bug Something isn't working pending triage The issue/PR is currently untouched. labels Dec 6, 2023
@sfc-gh-jdaly
Copy link

Looks like this is the same issue that is described here:
#4770 (comment)

My guess is that it will be fixed by: #4928

@Boshen Boshen self-assigned this Dec 7, 2023
@Boshen Boshen removed the pending triage The issue/PR is currently untouched. label Dec 7, 2023
@JohnDaly
Copy link
Author

This was fixed in rspack 0.4.3. Thanks @Boshen!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants