-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot read property 'tokens' of undefined #12071
Comments
caused by this commit 0849f84 I hope @davidaurelio can give me a hint since I'm not fully understand this patch. |
I have the same issue, I debugged it a little bit and I found that error occurs on the line https://github.com/babel/babel/blob/master/packages/babel-generator/src/index.js#L16, because somehow |
The issue is solved in the version 0.41, it can be closed. |
@gitim I am getting this again in 0.42-rc2. |
Also getting this on 0.42.0-rc3, and confirmed working downgrading to 0.41.0. |
Just encountered this problem in 0.42.0 release. 0.41 works fine. |
What is the |
@ericvicenti: This error occurs during packaging, not while using the library. |
@ericvicenti please reopen the issue |
probably related to #12695 |
any workaround idea? |
@antoinerousseau remove all files from .babelignore or "ignore" section of "babelrc". |
@seavan that did the trick, thanks! |
@seavan 's suggestion doesn't work for me because I don't have anything being ignored. So this continues to prevent me from moving up to 0.42 |
@jpaas seavan is not refering to your .babelrc/.babelignore if I understand well. He refers to the .babelrc of the intl node module. It's better explained in this discussion: andyearnshaw/Intl.js#264 I went for the workaround they propose there: remove the .babelrc file of the intl module in the postinstall of your package.json, it works fine until a better solution is found. |
React-packager tries to parse .babelrc and .babelignore in node_modules as well as in the source directories. So yeah, if you have a NPM module which has .babelrc with "ignore" - you'll have problems. When we have such problems we do it like this:
That actually is enough. Your task won't copy '.babelrc', your packager won't try to parse it (unless you reference it as |
Or as @didaktik wrote, just add |
Ah thank-you @didaktik that makes more sense. Well at least we have a workaround for now. |
Summary: - [x] Explain the **motivation** for making this change. - [x] Provide a **test plan** demonstrating that the code is solid. - [x] Match the **code formatting** of the rest of the codebase. - [x] Target the `master` branch, NOT a "stable" branch. I have a need to bundle a pre-optimized external lib with my RN application. Until RN 0.42 I had been using a .babelignore to prevent the packager from trying to optimize this file and choke. It seems in 0.42 and higher I'm no longer allowed to ignore the file. This issue has also been reported as #12071 Details on the reasoning for this patch can be found in the issue I originally filed: #13168 What existing problem does the pull request solve? This PR restores the functionality with babel ignoring files that existed in 0.41 before this patch: 0849f84#diff-4676ea0b3c55c65c3929aa993144f07f Here's a screenshot of this patch properly ignoring the file I referenced in #13168 to be ignored. ![screen shot 2017-04-27 at 12 48 32 am](https://cloud.githubusercontent.com/assets/21967/25469653/524dbc0c-2ae3-11e7-81a6-faca2f4d21fe.png) The patch relies on the `ignored` value of the call to `babel.transform` and if true returns the src in a object per instruction from loganfsmyth from BabelJS core team. To test, add a file to the `ignore` array of a `.babelrc` file in a React Native project with this fork. I was unable to locate a test file for the transformer.js Fixes #12071, #13168 Closes #13681 Differential Revision: D5017565 Pulled By: davidaurelio fbshipit-source-id: 421f57b5ce192eedd46fae4285d8a741cb5f8e71
Summary: - [x] Explain the **motivation** for making this change. - [x] Provide a **test plan** demonstrating that the code is solid. - [x] Match the **code formatting** of the rest of the codebase. - [x] Target the `master` branch, NOT a "stable" branch. I have a need to bundle a pre-optimized external lib with my RN application. Until RN 0.42 I had been using a .babelignore to prevent the packager from trying to optimize this file and choke. It seems in 0.42 and higher I'm no longer allowed to ignore the file. This issue has also been reported as facebook#12071 Details on the reasoning for this patch can be found in the issue I originally filed: facebook#13168 What existing problem does the pull request solve? This PR restores the functionality with babel ignoring files that existed in 0.41 before this patch: facebook@0849f84#diff-4676ea0b3c55c65c3929aa993144f07f Here's a screenshot of this patch properly ignoring the file I referenced in facebook#13168 to be ignored. ![screen shot 2017-04-27 at 12 48 32 am](https://cloud.githubusercontent.com/assets/21967/25469653/524dbc0c-2ae3-11e7-81a6-faca2f4d21fe.png) The patch relies on the `ignored` value of the call to `babel.transform` and if true returns the src in a object per instruction from loganfsmyth from BabelJS core team. To test, add a file to the `ignore` array of a `.babelrc` file in a React Native project with this fork. I was unable to locate a test file for the transformer.js Fixes facebook#12071, facebook#13168 Closes facebook#13681 Differential Revision: D5017565 Pulled By: davidaurelio fbshipit-source-id: 421f57b5ce192eedd46fae4285d8a741cb5f8e71
Hoping this gets merged in soon. Can't currently run |
Any news here? Seems that this is still broken and its not the intl lib?! |
@nerdmed The current solution is to add the following to your
If that's not working for you, you might have another NPM that's including a |
Looks like it was fixed in 0.45.1 https://github.com/facebook/react-native/releases I've just personally confirmed it works for me after I upgraded react-native and removed the |
Description
I'm testing my app on
react-native
master. And having such error during transformationUnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 548): SyntaxError: TransformError: /Users/headless/tmp/TestIntlCrash/node_modules/intl/lib/core.js: Cannot read property 'tokens' of undefined
Reproduction
new project with intl dependency
https://github.com/skv-headless/TestIntlCrash
Solution
Not yet.
Additional Information
The text was updated successfully, but these errors were encountered: