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

chore(vite): remove main and module fields #8296

Closed
wants to merge 1 commit into from
Closed

chore(vite): remove main and module fields #8296

wants to merge 1 commit into from

Conversation

ydcjeff
Copy link
Contributor

@ydcjeff ydcjeff commented May 23, 2022

Description

Since Vite 3 supports Node 14+ and there is already an exports field which takes more priority than main and module so Node will only from exports and will never reach to main and module field entries.

cc @bluwy

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.

Since Vite 3 supports Node 14+ and there is already an `exports` field which takes more priority than `main` and `module` so Node will only from `exports` and will never reach to `main` and `module` field entries.
@antfu
Copy link
Member

antfu commented May 24, 2022

I see no harm to keep them for a while longer for compatibility, for example, eslint seen failed to read it.

Copy link
Member

@bluwy bluwy left a comment

Choose a reason for hiding this comment

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

Make sense to me. main won't be used at all with exports in node14, and most modern bundlers would read from exports than module these days.

My side project is also suggesting it as well :)
image

Thanks for catching this

@bluwy bluwy added the p1-chore Doesn't change code behavior (priority) label May 24, 2022
@ydcjeff
Copy link
Contributor Author

ydcjeff commented Jun 7, 2022

Unfortunately, there isn't a proper solution to fix the linting error. The rule node/no-missing-import updated was at the end of 2020 and also rule import/no-unresolved didn't support omitting main field yet (import-js/eslint-plugin-import#2132).

So, I will close this and let's keep them for a while.

@ydcjeff ydcjeff closed this Jun 7, 2022
@ydcjeff ydcjeff deleted the ydcjeff-patch-1 branch June 7, 2022 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p1-chore Doesn't change code behavior (priority)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants