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

Conditions not prioritized over mainFields. #14146

Closed
7 tasks done
mkilpatrick opened this issue Aug 17, 2023 · 1 comment
Closed
7 tasks done

Conditions not prioritized over mainFields. #14146

mkilpatrick opened this issue Aug 17, 2023 · 1 comment
Labels
duplicate This issue or pull request already exists

Comments

@mkilpatrick
Copy link

mkilpatrick commented Aug 17, 2023

Describe the bug

When I'm running a Vite build with

resolve: {
    conditions: ["worker", "webworker"],
},

and importing https://github.com/Andarist/react-textarea-autosize, I seem to be getting the browser version even though they define a worker in exports. Based on the Vite documentation about mainFields, the conditional exports should take precedence.

I notice that the library has a warning because they are defining browser both at the root and in exports.
https://publint.dev/react-textarea-autosize@8.5.2

I've confirmed that removing the root browser field from the package then allows the worker export to be loaded.

Reproduction

N/A

Steps to reproduce

No response

System Info

System:
    OS: macOS 12.6
    CPU: (10) arm64 Apple M1 Max
    Memory: 623.92 MB / 64.00 GB
    Shell: 5.2.15 - /usr/local/bin/bash
  Binaries:
    Node: 18.9.0 - ~/.nvm/versions/node/v18.9.0/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 9.4.1 - /opt/homebrew/bin/npm
    pnpm: 8.6.2 - /opt/homebrew/bin/pnpm
  Browsers:
    Chrome: 115.0.5790.170
    Safari: 16.4.1
  npmPackages:
    @vitejs/plugin-react: ^4.0.3 => 4.0.3 
    vite: ^4.4.9 => 4.4.9

Used Package Manager

npm

Logs

No response

Validations

@sapphi-red
Copy link
Member

Duplicate of #10323

@sapphi-red sapphi-red marked this as a duplicate of #10323 Aug 18, 2023
@sapphi-red sapphi-red closed this as not planned Won't fix, can't repro, duplicate, stale Aug 18, 2023
@sapphi-red sapphi-red added duplicate This issue or pull request already exists and removed pending triage labels Aug 18, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Sep 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants