mathiasbynens / punycode.js

A robust Punycode converter that fully complies to RFC 3492 and RFC 5891.
https://mths.be/punycode
MIT License
1.59k stars 158 forks source link

missing `es5` version breaks IE11 #86

Open sebastiankr opened 6 years ago

sebastiankr commented 6 years ago

Hallo Mathias,

while working on my Angular component library eang I realized that punycode@2.2.1 gets included into my build and since an es5 version is missing, it is breaking IE11.

Not sure why it is needed in the bundle at all, but others seem to have similar issues: https://github.com/angular/angular/issues/21202#issuecomment-406817464

Would you consider a PR integrating Typescript to transpile to es5 and es6?

KristiyanVachev commented 5 years ago

Downgrading to punycode@1.4.1 fixed the problem for me.

Seems to be an acceptable solution since the punycode repo itself states that:

The current version supports recent versions of Node.js only. It provides a CommonJS module and an ES6 module. For the old version that offers the same functionality ... see v1.4.1.

fhaussener commented 5 years ago

@KristiyanVachev I'm having the same problem right now. How did you manage to downgrade the version of punycode, since it's a nested dependency of uri-js?

KristiyanVachev commented 5 years ago

@KristiyanVachev I'm having the same problem right now. How did you manage to downgrade the version of punycode, since it's a nested dependency of uri-js?

I just did. npm install punycode@1.4.1

fhaussener commented 5 years ago

@KristiyanVachev I'm having the same problem right now. How did you manage to downgrade the version of punycode, since it's a nested dependency of uri-js?

I just did. npm install punycode@1.4.1

Did you install it on project root level or inside the uri-js folder?

KristiyanVachev commented 5 years ago

@KristiyanVachev I'm having the same problem right now. How did you manage to downgrade the version of punycode, since it's a nested dependency of uri-js?

I just did. npm install punycode@1.4.1

Did you install it on project root level or inside the uri-js folder?

Project root, but my problem wasn't with the instance uri-js had. Uri-js still uses 2.1.0 for the project, but seems like it's not being used.

fhaussener commented 5 years ago

@KristiyanVachev I'm having the same problem right now. How did you manage to downgrade the version of punycode, since it's a nested dependency of uri-js?

I just did. npm install punycode@1.4.1

Did you install it on project root level or inside the uri-js folder?

Project root, but my problem wasn't with the instance uri-js had. Uri-js still uses 2.1.0 for the project, but seems like it's not being used.

Interesting, do you know which part of your application used the wrong version of punycode? Do you have an idea, how I can find the part, which is using es6 code, since I am getting my Syntax Errors in random places.

blained3 commented 5 years ago

Are there any plans on implementing this? it is now a huge cause for error on those who use angular build and support ie11.

ryanbowden commented 5 years ago

Also having the same issue and we need this fixed.

davidgolden commented 5 years ago

I was able to fix this by sticking this in my webpack babel-loader config:

exclude: function (modulePath) { return /node_modules/.test(modulePath) && !/punycode/.test(modulePath); };

michael-letcher commented 5 years ago

I'm having the same issue adding punycode@1.4.1 as a depency did not fix my issue though. It still fails.

const ucs2encode = array => String.fromCodePoint(...array);

DanHitt commented 5 years ago

Same issue.

bndby commented 5 years ago

I'm having the same issue adding punycode@1.4.1 as a depency did not fix my issue though. It still fails.

const ucs2encode = array => String.fromCodePoint(...array);

same issue

Markosyan-AR commented 5 years ago

Lots of packages are dependent from this one. Millions of downloads. And es2015 syntax breaks ie apps. And still not fixed...

const ucs2encode = function(array) { return String.fromCodePoint.apply(array); }

Guys, can it be fixed that way?

hgrubst commented 4 years ago

If using yarn you can add the following at the bottom of your package.json to force a resolution of version 1.4.1 : "resolutions": { "punycode" : "1.4.1" }