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

Vite does not correctly map browser field #11208

Closed
7 tasks done
luo3house opened this issue Dec 6, 2022 · 1 comment · Fixed by #11219
Closed
7 tasks done

Vite does not correctly map browser field #11208

luo3house opened this issue Dec 6, 2022 · 1 comment · Fixed by #11219

Comments

@luo3house
Copy link
Contributor

Describe the bug

Vite does not correctly map the browser field
when it meet import { current } from "lib-a".

{
  "name": "lib-entry",
  "browser": {
    "lib-a": "lib-b"
  }
}

Vite Resolved:

import { current } from "lib-a"

Expected (Rollup resolved):

import { current } from "lib-b"

Tested versions:

  • 3.2.5
  • v4.0.0-beta.0

Reproduction

https://github.com/luo3house/vite-bug-browserfield

Steps to reproduce

README.md

System Info

System:
  OS: Linux 5.4 Ubuntu 20.04.5 LTS (Focal Fossa)
  CPU: (2) x64 Intel(R) Xeon(R) Platinum 8272CL CPU @ 2.60GHz
  Memory: 2.36 GB / 3.84 GB
  Container: Yes
  Shell: 5.0.17 - /bin/bash
Binaries:
  Node: 16.18.1 - ~/nvm/current/bin/node
  Yarn: 1.22.19 - /usr/bin/yarn
  npm: 8.19.2 - ~/nvm/current/bin/npm

Used Package Manager

pnpm

Logs

No response

Validations

@abdelkrimdev
Copy link

I'm having the same issue on both 3.2.5 and v4.0.0-beta.0 🤔
I tested it on Webpack and it works just fine but not on Vite.
Here is a minimal, reproducible example: https://stackblitz.com/edit/vitejs-vite-qtvcrk

bluwy added a commit that referenced this issue Mar 2, 2023
Co-authored-by: bluwy <bjornlu.dev@gmail.com>
@github-actions github-actions bot locked and limited conversation to collaborators Mar 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants