tailwindlabs / heroicons

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

@heroicons/vue/solid' is not supported resolving ES modules imported #564

Closed andysay closed 2 years ago

andysay commented 2 years ago

Directory import '/Users/f/Desktop/ssf/.output/server/node_modules/@heroicons/vue/solid' is not supported resolving ES modules imported

AlexSwtlsk commented 2 years ago

If you're looking for a quick fix you can add /index.js at the end :

import { … } from '@heroicons/vue/outline/index.js'
Bryanoxx commented 2 years ago

On the latest version of Nuxt 3 I'm using (v3.0.0-27389502.88da719), this quick fix didn't work :/

But I still succeed to make it work by adding this option in the nuxt.config.ts file :

build: {
    transpile: ['@heroicons/vue']
}
arneetsingh commented 2 years ago

Thanks @Bryanoxx, I was facing exact same issue, it works now 🥳

bradlc commented 2 years ago

Hey, thanks for your bug report!

I have to close this as a reproduction was not provided. Trying to create a reproduction ourselves from the information in an issue drastically increases the amount of time it takes for us to provide a solution and if we have do that for every issue it’s impossible for us to keep up.

If this is still an issue for you, please open a new issue but include a proper reproduction — a GitHub repository where you already have everything all set up so we can clone it and immediately see the issue without configuring everything by hand.

Sorry, not trying to be dismissive and definitely want to fix the issue if there is one, but we have to be strict about this one or there's no way we could keep up with the number of questions we get across all of our projects. Hope that's understandable!

tordans commented 1 year ago

@bradlc

I have to close this as a reproduction was not provided.

Does this count as reproducible? This commits https://github.com/FixMyBerlin/rsv8-lb-wn/pull/5/commits/a3813e5dca55852e222632b7941be343521693f2 holds an Astro page which imports Heroicons eg here https://github.com/FixMyBerlin/rsv8-lb-wn/pull/5/files#diff-9ea9be09622c940b2e12b52cb9eaed6da357ed5120919c80c47758f97c986bb2L2.

npm run dev will work, but npm run build will fail.

 generating static routes
 error   Directory import '/Users/…/node_modules/@heroicons/react/24/solid' is not supported resolving ES modules imported from /Users/fmc/Development/rsv8-lp-astro/dist/entry.mjs

Astro uses ViteJS which behaves differently when using build vs. start/dev.

The issue can indeed be worked around (see https://github.com/FixMyBerlin/rsv8-lb-wn/pull/5/commits/37f1b2ca715e901fd102a70b2827814cea9812b8), however it would be great if it worked out of the box…

riderx commented 1 year ago

For the one like me who has this problem again when upgraded to latest: now it work, so you need to remove the fix:

  build: {
    transpile: ['@heroicons/vue'],
  },

Otherwise you have the issue ^^