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

Add root-level import #936

Merged
merged 4 commits into from
Feb 17, 2023
Merged

Add root-level import #936

merged 4 commits into from
Feb 17, 2023

Conversation

thecrypticace
Copy link
Contributor

@thecrypticace thecrypticace commented Feb 17, 2023

Vite has an optimizeDeps pass that does not like that you can't import from @heroicons/react or @heroicons/vue directly. This is because we do not have a main / module / exports."." entry in our package.json. This was intentional because such an import is invalid. You must import from one of:

  • @heroicons/react/20/solid
  • @heroicons/react/24/solid
  • @heroicons/react/24/outline
  • @heroicons/vue/20/solid
  • @heroicons/vue/24/solid
  • @heroicons/vue/24/outline

However, because of this problem we need one to exist for Vite to not break if it decides to optimize deps and include @heroicons/react (or @heroicons/vue) either because there's many packages, because the user has forced them on for all packages, or it's been explicitly included by the user.

This PR solves this by adding root-level entry points for @heroicons/react and @heroicons/vue. If someone tries to use these imports directly we will throw an error at runtime letting them know the correct path(s) to import.

Fixes #934

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.

[React] Vite can't resolve the entries for the package
1 participant