icon icon indicating copy to clipboard operation
icon copied to clipboard

Component does not fall back to Iconify API when using client-side rendering

Open JakeIsMeh opened this issue 1 year ago • 5 comments

SSR works as the icons show up on initial load.
Also tested with ssr: false.

Repro: https://github.com/JakeIsMeh/nuxt-icon-static-repro

https://github.com/nuxt/icon/assets/33054273/d3855208-8ecb-4433-a754-2e271a2c1dab

JakeIsMeh avatar Jun 26 '24 17:06 JakeIsMeh

I may be seeing this same thing. My uil icons show up fine in dev mode but in the generated static site, the api calls return 404.

 HTTP  2024-6-30 6:21:37 PM ::1 GET /api/_nuxt_icon/uil.json?icons=moon%2Csun
 HTTP  2024-6-30 6:21:37 PM ::1 Returned 404 in 4 ms

This makes sense (?) because there is no local API server at all (it's a static site), and the .output/public dir does not contain a _nuxt_icon subdir.

garyo avatar Jun 30 '24 22:06 garyo

I have the same (or similar) issue. On first load, the icons show up on the page I visit, but if I navigate to another page on my app, I get a 404. If I refresh this page, the icons show up and the 404 is not thrown. Navigating to other pages repeats this behaviour consistently. Strange behaviour.

GET /api/_nuxt_icon/mdi.json?icons=alert-decagram%2Carrow-left-circle-outline%2Ccalculator-variant%2Crobot-excited-outline%2Cvideo-input-antenna 404 (Not Found)

Running nuxt 3.12.3 and @nuxt/icon 1.0.0

danielvlla avatar Jul 03 '24 14:07 danielvlla

I have the same problem

nebykoff avatar Jul 05 '24 04:07 nebykoff

Me too

kicaj avatar Jul 06 '24 18:07 kicaj

Same situation

deep-project avatar Jul 09 '24 02:07 deep-project

Same problem

tidan-16 avatar Jul 15 '24 12:07 tidan-16

The fix in de92533 did not actually fix it for me, since I'm generating a static site (nuxt generate). I still had to manually preload all the icons I wanted. But using the idea from the fix, I added this to my nuxt.config.ts and that does seem to fix it:

  icon: {
    provider: 'iconify'
  },

garyo avatar Jul 16 '24 13:07 garyo