Skip to content

Add root-level import#936

Merged
thecrypticace merged 4 commits intomasterfrom
fix/root-import
Feb 17, 2023
Merged

Add root-level import#936
thecrypticace merged 4 commits intomasterfrom
fix/root-import

Conversation

@thecrypticace
Copy link
Copy Markdown
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