React-native: Packager fails loading Intl polyfill for Android

Created on 3 Mar 2017  路  7Comments  路  Source: facebook/react-native

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
Locked

Most helpful comment

@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

All 7 comments

cc @ericvicenti since you closed the previous bug report

It's also happening here... same setup.

I have the same problem. Do anyone find workaround?

I have the same problem too, so I back to the 0.41.2

@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

alexandrebini's solution doesn't work for me on RN v0.44.2 on Linux. It's weird.

This issue has been opened on March 3rd.

I wonder that is there any workaround to overcome this issue.

I cannot run the project on emulator.

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.

Was this page helpful?
0 / 5 - 0 ratings