tailwindlabs / heroicons

A set of free MIT-licensed high-quality SVG icons for UI development.
https://heroicons.com
MIT License
21.03k stars 1.27k forks source link

Add root-level import #936

Closed thecrypticace closed 1 year ago

thecrypticace commented 1 year ago

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:

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