Closed Guipsss closed 1 year ago
What version of Vite are you using?
@thecrypticace version 4.0.3
Faced the same issue today using Vite 4.1.1. Can confirm that adding a default export for .
solves it.
Can you tell me what your imports and Vite config look like? I am unable to reproduce this problem. (I will note that you cannot import from @heroicons/react
but only from one of it's sub-packages: @heroicons/react/20/solid
, @heroicons/react/24/solid
, @heroicons/react/24/outline
— but this is not a new limitation)
@Guipsss @vskolos Also is there any chance either or both of you could provide reproduction repos?
Ah I think I've figured out what the issue is — this isn't a new problem at all but just an issue with the way optimizeDeps works in Vite. Working on a fix!
The error message suggests that the package @heroicons/react is missing a default export, which can be fixed by adding one in its package.json file.
To fix this error, you can follow these steps:
Locate the package.json file for the @heroicons/react package in your project's node_modules directory.
Add the following code block to the exports field in the package.json file for @heroicons/react:
".": { "default": "./package.json" },
This specifies a default export for the package.
npm install @heroicons/react
npm install @heroicons/react
This should download the latest version of the package, including the newly added default export.
@thecrypticace awesome. When is the new release going to be available so I can update the package?
I've addressed the problem in #936. Basically, Vite's optimizeDeps
feature requires a package have a root-level import even when it's not ever going to be used.
@Guipsss can you test the insiders build and let me know if the problem has been fixed for you? npm install @heroicons/react@insiders
@thecrypticace yes, it's fixed using the insiders build. Running locally, building and running storybook are all fixed now.
@Guipsss excellent — thanks for the confirmation! I've published v2.0.16 with the fix.
@thecrypticace awesome. Thank you so much!
I'm getting this error when trying to run my application after installing the package.
Adding a default export for
.
, as shown bellow, fixes it.