Intl.js icon indicating copy to clipboard operation
Intl.js copied to clipboard

Intl.js with polyfill not working on Safari

Open gabouy opened this issue 8 years ago • 25 comments
trafficstars

We were using this library successfully but for some reason it stopped working last Friday.

When loading the html that includes the Intl polyfill reference (https://cdn.polyfill.io/v2/polyfill.min.js?features=Intl.~locale.en) the following errors are displayed in Safari:

polyfill-error

The result is a blank page instead of the expected content loaded.

Not sure if this is an Intl.js error, or a polyfill one, but any help would be greatly appreciated!

gabouy avatar Nov 20 '16 13:11 gabouy

@mtlewis could this be related to #244?

caridy avatar Nov 21 '16 15:11 caridy

@caridy Yes, I would expect this to be fixed by #244 :D

mtlewis avatar Nov 21 '16 19:11 mtlewis

Ok, I will try to do the release tomorrow morning.

caridy avatar Nov 21 '16 22:11 caridy

@caridy Any chance of doing a release?

ruiaraujo avatar Nov 23 '16 10:11 ruiaraujo

@caridy friendly reminder

Turbo87 avatar Dec 02 '16 13:12 Turbo87

Any news on this release @caridy?

mtlewis avatar Dec 16 '16 10:12 mtlewis

As a workaround you can use v1.2.4 for now. But definitely project needs more collaborators!

chicoxyzzy avatar Dec 16 '16 11:12 chicoxyzzy

@chicoxyzzy unfortunately that is not an option when using it with polyfill.io... 😞

Turbo87 avatar Dec 16 '16 11:12 Turbo87

@Turbo87 Remove it from polyfill.io and polyfill it yourself for a while until it is fixed. A bloated bundle is better than a broken site.

ruiaraujo avatar Dec 16 '16 12:12 ruiaraujo

@ruiaraujo to be honest I'd rather work on fixing the cause of the problem, but that unfortunately seems harder than I hoped...

Turbo87 avatar Dec 16 '16 12:12 Turbo87

@reiniergs is helping with the tests at the moment, trying to get the test suite back to life, and validate that we are good. We don't want to push a broken build again (like the RegExp issue from last time). I'm currently out until the second week of January. Apologies for the inconvenience, and I will be very supportive of more hands on the deck, if someone has time to help.

caridy avatar Dec 16 '16 14:12 caridy

@caridy thanks for the feedback! can you elaborate on what is wrong with the test suite? any way we can help?

Turbo87 avatar Dec 16 '16 15:12 Turbo87

@Turbo87 the saucelab config is a mess at the moment. On top of that, errors happening during the testing process are completely obscure (at the moment there are ~18 failures on IE, but the error tells nothing about the actual error).

caridy avatar Dec 16 '16 16:12 caridy

Um.. just a little note that while waiting for the fix, we can also disable "RegExp cache / restore" as explained in the documentation if you want to use latest version (or if you must, thank to polyfill.io)

I'm not sure about everyone's cases, but it works for mine and I also think the document is right that it "is not strictly necessary" and you can disable it.

thien-do avatar Dec 16 '16 21:12 thien-do

Same happening on on 1.2.5 IE10, 1.2.4 works fine

olaf89 avatar Dec 20 '16 11:12 olaf89

@caridy please let me know if there's anything (#244 related or otherwise) that I can do to help get the next version ready for release. :+1:

mtlewis avatar Jan 18 '17 23:01 mtlewis

I just ran into this problem with the npm package for NodeJS (thus not Polyfill.io)...

SyntaxError: Invalid regular expression: /[\s\S]{2}(((((((())))))))[\s\S]{1})[\s\S]{3}/: Unmatched ')'
    at new RegExp (<anonymous>)
    at C:\Source\TweeDuizenden\node_modules\intl\lib\core.js:590:20
    at InitializeNumberFormat (C:\Source\TweeDuizenden\node_modules\intl\lib\core.js:2077:5)
    at new NumberFormatConstructor (C:\Source\TweeDuizenden\node_modules\intl\lib\core.js:1838:12)
    at CreateDateTimeParts (C:\Source\TweeDuizenden\node_modules\intl\lib\core.js:3898:14)
    at FormatDateTime (C:\Source\TweeDuizenden\node_modules\intl\lib\core.js:4079:17)
    at DateTimeFormatConstructor.F (C:\Source\TweeDuizenden\node_modules\intl\lib\core.js:3848:20)
    at Object.getLocaleDateString (C:\Source\TweeDuizenden\app\helpers.js:65:107)
    at C:\Source\TweeDuizenden\controllers\game.js:322:42
    at model.Query.<anonymous> (C:\Source\TweeDuizenden\node_modules\mongoose\lib\model.js:3731:16)
    at C:\Source\TweeDuizenden\node_modules\kareem\index.js:277:21
    at C:\Source\TweeDuizenden\node_modules\kareem\index.js:131:16
    at _combinedTickCallback (internal/process/next_tick.js:73:7)
    at process._tickCallback (internal/process/next_tick.js:104:9)

One proposed solution above about disabling RegExp cache doesn't work.


Intl 1.2.5
NodeJS v7.7.4
npm 4.1.2

Edit: see https://github.com/andyearnshaw/Intl.js/issues/231

jerone avatar Apr 28 '17 19:04 jerone

Intl 1.2.5 NodeJS 6.10.3 Npm 5.0.4 When polyfills is applaied i get this error message: Invalid regular expression: /[\s\S]{4}(((((((())))))))[\s\S]{3})/: Unmatched ')'

No news about it?

matte00 avatar Oct 02 '17 09:10 matte00

Based on PR and issue discussions it looks like #244 fixed this, but there hasn't been a release since 11/16/16 when it was merged.

mfollett avatar Oct 02 '17 16:10 mfollett

Wow it has been so long since this issue appear.. Now we even already dropped support for Safari < 10, which is the reason we need to use this library in the first place 😂

thien-do avatar Oct 03 '17 11:10 thien-do

Meanwhile downgrade to 1.2.4..it's works fine!

matte00 avatar Oct 05 '17 06:10 matte00

This is still an issue. We hard coded 1.2.4 and removed the carot from our package.json for now.

tony99nyr avatar Nov 10 '17 15:11 tony99nyr

Thanks to @dvkndn, disabling regex caching seems to fix the problem for me as well:

Intl.__disableRegExpRestore()

HenokT avatar Dec 05 '17 15:12 HenokT

Also having SyntaxError: Invalid regular expression: /[\s\S]{4}(((((((())))))))[\s\S]{3})/: Unmatched ')'. Started having it randomly.

Intl.__disableRegExpRestore() works.

But the workaround won't work in this case:

// Determine if the built-in `Intl` has the locale data we need
if (!are_intl_locales_supported(locales))
{
	// `Intl` exists, but it doesn't have the data we need, so load the
	// polyfill and patch the constructors we need with the polyfill's
	Intl.NumberFormat   = Intl_polyfill.NumberFormat
	Intl.DateTimeFormat = Intl_polyfill.DateTimeFormat
}

Hard-coding version 1.2.4 in package.json then.

Intl is present in all modern browsers except Internet Explorer 10, Safari 9 and iOS Safari 9.x.

Node.js server-side rendering will still need it because Node only comes prepackaged with English language.

catamphetamine avatar Jan 08 '18 16:01 catamphetamine

Intl is present in all modern browsers except Internet Explorer 10, Safari 9 and iOS Safari 9.x.

It's not available outside the browser, which is still something lots of people face (Node, react-*). I had the same problem today. It's actually very annoying to get a previous version when there are requirements for >1.2.5, so would be great to get a 1.2.6 release to fix this!

mbrucher avatar Aug 30 '19 21:08 mbrucher