Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
LikeDreamwalker opened this issue Jul 3, 2022 · 6 comments

Comments

@LikeDreamwalker
Copy link

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:

@LikeDreamwalker
Copy link
Author

LikeDreamwalker commented Jul 3, 2022

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

@LikeDreamwalker
Copy link
Author

LikeDreamwalker commented Jul 4, 2022

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.

@nfroidure
Copy link
Owner

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

@abdelhakimrafik
Copy link

abdelhakimrafik commented Nov 3, 2022

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.

@nfroidure
Copy link
Owner

@abdelhakimrafik sure, proceed :). Thanks!

@bartberden
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants