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 2.7.0 warning fix by using conditional exports #614

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

FossPrime
Copy link
Contributor

@FossPrime FossPrime commented Dec 9, 2021

Summary

Vite 2.7.0 users are getting @feathersjs/vuex is incorrectly packaged. Please contact the package author to fix.
vitejs/vite#6013
Screenshot from 2021-12-08 15-08-53

This provides a fix by declaring that we export ESM. The main is still technically incorrect, but that's harder to fix as we use Typescript and they haven't released Node Native ESM support as of TS 4.5.
The same fix works on 4.0.1-pre.7, which someone forgot to tag in GH

Sandbox

https://stackblitz.com/edit/feathersjs-wy4w68?file=vuex-package.json

Risks

  • Declaring exports makes Node block access to undeclared entry points
  • I've only tested this on one environment... I'd let it simmer for a week. Unless you're pushing to the alpha... in which case...

Alternative solutions

  • change the extension of the main script to .mjs
  • Change the package.json/type to "module" (could break tests, debugging, typescript linting etc)

Sources

https://nodejs.org/api/packages.html#conditional-exports

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

1 participant