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

feat(resolve): only use exports field when defined in package.json #8484

Closed
wants to merge 1 commit into from

Conversation

aleclarson
Copy link
Member

Description

Match how Node's resolution algorithm works and only consider pkg.exports when it's defined.

From the Node docs:

The "exports" field provides an alternative to "main" where the package main entry point can be defined while also encapsulating the package, preventing any other entry points besides those defined in "exports".

Additional context


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.

@bluwy
Copy link
Member

bluwy commented Jul 5, 2022

Looks like this fixes the svelte node condition issue I stumbled on recently, where pkg.module was preferred over pkg.exports because the latter ended with .mjs. I can add some tests for this soon.

@aleclarson
Copy link
Member Author

@bluwy awesome! 🧇

@aleclarson
Copy link
Member Author

Merged into #10504

@aleclarson aleclarson closed this Oct 18, 2022
@bluwy
Copy link
Member

bluwy commented Oct 18, 2022

Sorry I never got to writing the tests 😅

@aleclarson
Copy link
Member Author

Sorry I never got to writing the tests 😅

Honestly, I totally forgot about this PR, so no apology required :)

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.

2 participants