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

Follow up to #843, refining exports and browser field interaction #866

Merged
merged 10 commits into from Apr 30, 2021

Conversation

Jarreddebeer
Copy link
Contributor

@Jarreddebeer Jarreddebeer commented Apr 22, 2021

Rollup Plugin Name: node-resolve

This PR contains:

  • bugfix
  • feature
  • refactor
  • documentation
  • other

Are tests included?

  • yes (bugfixes and features will not be merged without tests)
  • no

Breaking Changes?

  • yes (breaking changes will not be merged unless absolutely necessary)
  • no

If yes, then include "BREAKING CHANGES:" in the first commit message body, followed by a description of what is breaking.

List any relevant issue numbers: #843, #786

Description

This is a follow up to #843 and #786 based on refining the interaction between the exports and browser field. Specifically of the cases tested in #843. It updates the resolution of the exports field to apply browser internal mappings from the browser field only. Update: It appears upstream changes to node-resolve/src/index.js handle the browser internal mappings, so I have removed the files changed relating to that from the PR.

To help aid usability of exports and browser interaction this PR also made it so that setting {browser: true} in the options will also automatically apply the browser exports conditions. This will avoid common pitfalls by having a single configuration for browser mapping.

Tests are adapted from #843 and the output are aligned with webpack output for the web target.

Thanks for your review in advance.

@shellscape
Copy link
Collaborator

It looks like we have some issues with pnpm and the latest major, and some dependency issues. I'll get those cleaned up soon.

@shellscape
Copy link
Collaborator

We've just updated master. Please update your fork from upstream/master.

Copy link
Contributor

@guybedford guybedford left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @Jarreddebeer. I like the idea of having the browser: true option also enable the browser condition, so a +1 from me here.

Copy link
Contributor

@guybedford guybedford left a comment

Choose a reason for hiding this comment

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

LGTM, I like the unified browser: true switch here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants