Packager fails loading Intl polyfill for Android
See original GitHub issueDescription
For using React-intl on android we must add a polyfill, since Intl isn’t supported yet in android. When importing the Intl polyfill in RN41.2 the react-intl library works fine. When using the same import in RN 42 the following error is thrown:
UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 548): SyntaxError: TransformError: /Users/headless/tmp/TestIntlCrash/node_modules/intl/lib/core.js: Cannot read property 'tokens' of undefined
This is the same error as described in https://github.com/facebook/react-native/issues/12071, but since the issue was closed for an unclear issue name, I created this issue.
Reproduction
Try using react-intl in an android emulator, then try including the intl polyfill with
import 'intl';
When testing in RN41.2 it will work, in RN 42 it won’t
Solution
Something seems to be wrong when the packager processes the core.js
file
Additional Information
- React Native version: 41.2 vs 42
- Platform: Android
- Operating System: MacOS
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:7 (2 by maintainers)
Top Results From Across the Web
React-Native and Intl polyfill required on Android device
I get the following error: [React Intl] Error formatting number. ReferenceError: No locale data has been provided for this object yet.
Read more >Intl.DateTimeFormat (ESNext) | Format.JS
A spec-compliant polyfill for Intl.DateTimeFormat fully tested by the official ECMAScript Conformance test suite.
Read more >Add Intl support | Voters - Expo
We'd like to use Luxon in our app, it is currently not possible because Android JSC is built without it. It would be...
Read more >Browser support - Angular
You compensate by loading polyfill scripts ("polyfills") for the browsers that you must support. See instructions on how to include polyfills into your...
Read more >Polyfill.io
It's a service which accepts a request for a set of browser features and returns only the polyfills that are needed by the...
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
@doochik adding this on
package.json
fixed for memore here: https://github.com/andyearnshaw/Intl.js/pull/264#issuecomment-279947557
Hi there! This issue is being closed because it has been inactive for a while. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. Either way, we’re automatically closing issues after a period of inactivity. Please do not take it personally!
If you think this issue should definitely remain open, please let us know. The following information is helpful when it comes to determining if the issue should be re-opened:
If you would like to work on a patch to fix the issue, contributions are very welcome! Read through the contribution guide, and feel free to hop into #react-native if you need help planning your contribution.