iconifyApiOptions custom API not working
leosin opened this issue · 3 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
Could you please now check with the new version? https://github.com/nuxt-modules/icon/releases/tag/v1.0.0-beta.1
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.