Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Intl.js with polyfill not working on Safari #256

Open
gabouy opened this issue Nov 20, 2016 · 25 comments
Open

Intl.js with polyfill not working on Safari #256

gabouy opened this issue Nov 20, 2016 · 25 comments

Comments

@gabouy
Copy link

gabouy commented Nov 20, 2016

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!

@caridy
Copy link
Collaborator

caridy commented Nov 21, 2016

@mtlewis could this be related to #244?

@mtlewis
Copy link
Contributor

mtlewis commented Nov 21, 2016

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

@caridy
Copy link
Collaborator

caridy commented Nov 21, 2016

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

@ruiaraujo
Copy link

@caridy Any chance of doing a release?

@Turbo87
Copy link
Contributor

Turbo87 commented Dec 2, 2016

@caridy friendly reminder

@mtlewis
Copy link
Contributor

mtlewis commented Dec 16, 2016

Any news on this release @caridy?

@chicoxyzzy
Copy link

chicoxyzzy commented Dec 16, 2016

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

@Turbo87
Copy link
Contributor

Turbo87 commented Dec 16, 2016

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

@ruiaraujo
Copy link

@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.

@Turbo87
Copy link
Contributor

Turbo87 commented Dec 16, 2016

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

@caridy
Copy link
Collaborator

caridy commented Dec 16, 2016

@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.

@Turbo87
Copy link
Contributor

Turbo87 commented Dec 16, 2016

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

@caridy
Copy link
Collaborator

caridy commented Dec 16, 2016

@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).

@thien-do
Copy link

thien-do commented Dec 16, 2016

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.

@olaf89
Copy link

olaf89 commented Dec 20, 2016

Same happening on on 1.2.5 IE10, 1.2.4 works fine

@mtlewis
Copy link
Contributor

mtlewis commented Jan 18, 2017

@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. 👍

@jerone
Copy link

jerone commented Apr 28, 2017

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 #231

@matte00
Copy link

matte00 commented Oct 2, 2017

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?

@mfollett
Copy link

mfollett commented Oct 2, 2017

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.

@thien-do
Copy link

thien-do commented Oct 3, 2017

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 😂

@matte00
Copy link

matte00 commented Oct 5, 2017

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

@tony99nyr
Copy link

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

@HenokT
Copy link

HenokT commented Dec 5, 2017

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

Intl.__disableRegExpRestore()

@catamphetamine
Copy link

catamphetamine commented Jan 8, 2018

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.

Turbo87 added a commit to Turbo87/skylines that referenced this issue May 19, 2018
This should hopefully address andyearnshaw/Intl.js#256 and not break anything else
motss added a commit to motss/app-datepicker that referenced this issue Jan 23, 2019
Due to andyearnshaw/Intl.js/issues/256, the Intl polyfill has to be
pinned at v1.2.4. It breaks on Safari 9 and using older version should
fix the broken tests.
motss added a commit to motss/app-datepicker that referenced this issue Jan 23, 2019
Fixes an issue where polyfill.io no longer works as expected to load
necessary polyfills via feature detections or UA detection. A quick
patch is to replace modern features with compatible codes to ensure
Chrome 41 is able to load and run the datepicker without any issues.

`pointerup` -> `click` event listener on scrim of
`<AppDatepickerDialog>`.

Due to andyearnshaw/Intl.js/issues/256, the Intl polyfill has to be
pinned at v1.2.4. It breaks on Safari 9 and using older version should
fix the broken tests.
motss added a commit to motss/app-datepicker that referenced this issue Jan 23, 2019
Fixes an issue where polyfill.io no longer works as expected to load
necessary polyfills via feature detections or UA detection. A quick
patch is to replace modern features with compatible codes to ensure
Chrome 41 is able to load and run the datepicker without any issues.

`pointerup` -> `click` event listener on scrim of
`<AppDatepickerDialog>`.

Due to andyearnshaw/Intl.js/issues/256, the Intl polyfill has to be
pinned at v1.2.4. It breaks on Safari 9 and using older version should
fix the broken tests.
@mbrucher
Copy link

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!

fabianishere added a commit to fabianishere/next.js that referenced this issue Apr 10, 2020
This change adds a workaround for an issue with the Intl.js polyfill
library where it instantiates an invalid regular expression.

Relevant issues:
andyearnshaw/Intl.js#270
andyearnshaw/Intl.js#256
andyearnshaw/Intl.js#306

Until this issue is fixed upstream, we use a workaround in the example.

Fixes: vercel#11777
fabianishere added a commit to fabianishere/next.js that referenced this issue Apr 10, 2020
This change adds a workaround for an issue with the Intl.js polyfill
library where it instantiates an invalid regular expression.

Relevant issues:
andyearnshaw/Intl.js#270
andyearnshaw/Intl.js#256
andyearnshaw/Intl.js#306

Until this issue is fixed upstream, we use a workaround in the example.

Fixes: vercel#11777
Timer pushed a commit to vercel/next.js that referenced this issue Apr 13, 2020
* Add workaround for Intl.js RegEx issue

This change adds a workaround for an issue with the Intl.js polyfill
library where it instantiates an invalid regular expression.

Relevant issues:
andyearnshaw/Intl.js#270
andyearnshaw/Intl.js#256
andyearnshaw/Intl.js#306

Until this issue is fixed upstream, we use a workaround in the example.

Fixes: #11777

* Do not load Intl.js polyfill by default on Node

This change updates the `with-react-intl` example to prevent it from
polyfilling `Intl` in a Node environment when it is not needed.
malte-laukoetter added a commit to malte-laukoetter/Falschparker that referenced this issue Jun 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests