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

fix(optimizer): browser field bare import (fix #7599) #10314

Merged
merged 5 commits into from Oct 5, 2022
Merged

fix(optimizer): browser field bare import (fix #7599) #10314

merged 5 commits into from Oct 5, 2022

Conversation

smeng9
Copy link
Contributor

@smeng9 smeng9 commented Oct 2, 2022

Description

Closes #7599
fixes #4798
fixes #7301
fixes #7576

Additional context

Make vite correctly resolve bare imports with browser field

In #8706 @sapphi-red mentioned we need to

solved by fixing implementation around idToPkgMap

instead of the way in #8709


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the Commit Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@sapphi-red sapphi-red added the p3-minor-bug An edge case that only affects very specific usage (priority) label Oct 4, 2022
@sapphi-red
Copy link
Member

Thank you! I confirmed that #4798, #7301, #7576 will be fixed by this PR.

Copy link
Member

@sapphi-red sapphi-red left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some nitpicks

packages/vite/src/node/plugins/resolve.ts Outdated Show resolved Hide resolved
packages/vite/src/node/plugins/resolve.ts Outdated Show resolved Hide resolved
@smeng9 smeng9 requested a review from sapphi-red October 5, 2022 04:57
"version": "0.0.0",
"main": "index.js",
"browser": {
"events": "./events-shim.js"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a note to anyone else who's equally as curious in the future as me, this is the "bare id mapping" in the browser field.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
4 participants