question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Packager fails loading Intl polyfill for Android

See original GitHub issue

Description

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:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
alexandrebinicommented, Mar 28, 2017

@doochik adding this on package.json fixed for me

"postinstall": "rm -f node_modules/intl/.babelrc"

more here: https://github.com/andyearnshaw/Intl.js/pull/264#issuecomment-279947557

0reactions
hramoscommented, Jul 31, 2017

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:

  • Does the issue still reproduce on the latest release candidate? Post a comment with the version you tested.
  • If so, is there any information missing from the bug report? Post a comment with all the information required by the issue template.
  • Is there a pull request that addresses this issue? Post a comment with the PR number so we can follow up.

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found