iconify/tools

importFromFigma unexpected fetch error

yunsii opened this issue · 5 comments

yunsii commented

When I use importFromFigma, it always throw a 404 error, after investigation, the real error is "ReferenceError: fetch is not defined"
image

So, I think this lib should handle error more elegant, and give a specific requirement of fetch. I use cross-fetch for now like:

import 'cross-fetch/polyfill'

Or integrated cross-fetch?

I can make a PR if possible.

Update node, newer versions have built in fetch.

yunsii commented

Update node, newer versions have built in fetch.

https://nodejs.org/en/blog/announcements/v18-release-announce#fetch-experimental Node 18 fetch is experimental feature. And I think the lib should give a specific requirement of fetch or node version.

That's old news from 1.5 years ago. In newer versions it is no longer experimental, it is stable and doesn't require any flags.

yunsii commented

That's old news from 1.5 years ago. In newer versions it is no longer experimental, it is stable and doesn't require any flags.

So lower node version developers only investigate and resolve the error by themselves.

I agree, error could be made clearer.

But there is no point in doing that. There is no excuse for using 2 years old version of node.