A polyfill for Intl should be included by default
See original GitHub issueOn Safari 9.1.1 for OS X (macOS) El Capitan and iOS 9.3.3, Angular 2 raises an uncaught exception when any built-in formatting pipe is used. To work in Safari, a polyfill for Intl
must be included.
This bug can be reproduced by opening the following plnkr in Safari: http://plnkr.co/edit/ETQGYstBK8MF8YVF78Kj?p=preview
This bug can also be reproduced in angular-cli
, version 1.0.0-beta.11-webpack.2:
- Install Angular 2.0.0-rc5 using
angular-cli
:
$ npm uninstall -g angular-cli && npm cache clean && npm install -g angular-cli@webpack
$ ng new intl-bug
- Add the following to a template in
app.component.html
:
<p>{{0.5 | percent:'1.1-1'}}</p>
- An uncaught exception will be written to the console. The template code will not appear, anything in the template after the above segment will fail to render, no further events or change detection will be handled, … basically everything breaks right there.
This bug was filed at angular/angular#10764, but closed recommending the polyfill. Since Angular 2’s built-in formatting filters fail on Safari without the polyfill, it should probably be a best practice of angular-cli
to include the Intl
polyfill by default.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:13 (4 by maintainers)
Top Results From Across the Web
Intl.PluralRules | Format.JS
A spec-compliant polyfill for Intl.PluralRules fully tested by the official ECMAScript ... By default the created URL does not come with any locale...
Read more >How to correctly polyfill Intl locale data - Stack Overflow
The intl polyfills repo shows how you can load only the necessary CLDR data via a CDN service as described here.
Read more >babel/polyfill
Babel includes a polyfill that includes a custom regenerator runtime and core-js. This will emulate a full ES2015+ environment (no < Stage 4...
Read more >intl - npm
Node.js 0.12 has the Intl APIs built-in, but only includes the English locale data by default. If your app needs to support more...
Read more >Use Webpack to Conditionally Include an Intl Polyfill for Older ...
[00:01] Let's start this lesson out by adding an intl-polyfill. In our terminal, I'll run yarn add intl as a dependency. With it...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Per cexbrayat on StackOverflow, the current version of angular-cli now exposes
src/polyfills.ts
, so that one can fix this particular problem by installingintl
:then adding the polyfills to polyfills.ts
This is a million times better than the situation when I filed this issue. I don’t know if this is quite finished since this particular polyfill is still so essential, but I’m much happier about this today.
Any news regarding this? I have installed the
intl
npm package and imported it inpolyfills.ts
, still getting errors on PhantomJS (on specs that pass on Chrome):