nfroidure/svgicons2svgfont

Uncaught TypeError: Cannot read properties of undefined (reading 'decode')

Opened this issue · 6 comments

Issue

I am trying to use in pure browser env ( from https://github.com/nfroidure/svgiconfont ) but I got this error. I check the log which shows me this issue happened inside so I think if there might be something newer than the example program. Really need help.

Steps to reproduce the behavior

I have a demo so it should be easy to reproduce.
npm i
npm run serve
There is a Vuetify File Uploader in the page, click then choose the .svgs it will happen in console.
https://github.com/LikeDreamwalker/if-generator

Debugging informations

  • node -v result:
v16.15.1
  • npm -v result:
8.11.0

Also for logs:

I just roll back to the version 3.0.2 and it worked, but I really want to use the newest version.
And issue version is the newest 12.0.0

don't know if they are related but I found in src/index.js used punycode and punycode has already been deprecated since node v7:
https://nodejs.org/api/punycode.html
so I think maybe edit package.json will help. And by my tests Ver 3.2.0 is the last version can support fully-use in browser. Since Ver 3.2.1, required punycode and maybe this is the reason.

@LikeDreamwalker I'll try to have a look but in the meanwhile, feel free to create a PR to remove it.

As @LikeDreamwalker mentioned, punycode is deprecated since: v7.0.0. The Node docs now recommend using punycode.js in place of it.

But the plugin itself has and issue if you are working with ESmodules as they export CommonJs implementation for both ESmodules and CommonJs, and this results in the error Uncaught TypeError: Cannot read properties of undefined (reading 'decode').

https://github.com/mathiasbynens/punycode.js/blob/6cd1ddd078176a5b2afdf09c60633217e2009e53/package.json#L7-L8

@nfroidure if no one is working on this issue i could take it.

@abdelhakimrafik sure, proceed :). Thanks!

@abdelhakimrafik I have the same issue, did you manage to resolve it?