nuxt / icon

The <Icon> component, supporting Iconify, Emojis and custom components.

Home Page:https://stackblitz.com/edit/nuxt-icon-playground?file=app.vue

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

iconifyApiOptions custom API not working

leosin opened this issue · comments

I didn't quite understand that iconifyApiOptions in the document is only used to provide CDN for the default official api, or it can provide its own icon.

For example:
First, I made sure that my custom API was written according to the official version and can be accessed normally.

https://localhost:3000/fal.json?icons=house

However, when I set the options below, it didn't work. Only when publicApiFallback:false is set will it work properly.

iconifyApiOptions: {
   url: 'http://localhost:3000',
   publicApiFallback: true,
},

// not working


Finally, when I was writing this question, I took a look at the nuxt-icon source code and found this snippet.

  if (appConfig.nuxtIcon?.iconifyApiOptions?.publicApiFallback) {
     addAPIProvider('custom', {
       resources: [appConfig.nuxtIcon?.iconifyApiOptions.url],
       index: 0
     })
     return
   }

// it works fine

Thank you very much for the prompt update, now it works.

But there will be a warn

WARN [Icon] Collection myicon is not found locally
We suggest to install it via npm i -D @iconify-json/myicon to provide the best end-user experience.

In other words, do I still need to make a local package? I am not very sure.

Ah, that's a good point. We could probably disable the warning when a custom end point is provided.