nuxt/icon

Locally installed `@iconify-json/*` packages result in 'needs an import attribute of type "json"' error

Closed this issue · 0 comments

After installing an @iconify-json/* package (@iconify-json/mdi in my scenario), the following error gets spit out when the /api/_nuxt_icon/:collection endpoint is called

image

It seems to be caused by the dynamic import missing the json import attribute on line 120 of module.ts

? `import('@iconify-json/${collection}/icons.json').then(m => m.default)`

Adding { with: { type: 'json' } } as a second parameter resolves the error for me:

import('@iconify-json/${collection}/icons.json', { with: { type: 'json' } }).then(m => m.default)`