You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
babelHelpers.objectDestructuringEmpty is not a function #4831
React Native, as you've probably heard, is getting really popular and truth is we're getting a bit overwhelmed by the activity surrounding it. There are just too many issues for us to manage properly.
If you don't know how to do something or not sure whether some behavior is expected or a bug, please ask on StackOverflow with the tag react-native or for more real time interactions, ask on Discord in the #react-native channel.
If this is a feature request or a bug that you would like to be fixed, please report it on Product Pains. It has a ranking feature that lets us focus on the most important issues the community is experiencing.
We welcome clear issues and PRs that are ready for in-depth discussion. Please provide screenshots where appropriate and always mention the version of React Native you're using. Thank you for your contributions!
Error:
stack: Error: Requiring unknown module "babel-runtime/core-js/number/min-safe-integer". If you are sure the module is there, try restarting the packager.
at requireImpl (http://192.168.20.127:8081/index.ios.bundle?platform=ios&dev=true:48:7)
You seem to be using very few transforms, and missing lots of transforms like destructuring, which might be causing the issue. It'll be better to copy/extend React Native's .babelrc and add what you need.
Aren't those transforms automatically being run by the RN packager @satya164 ? This was a special case of destructuring an empty object which I think caused the problem here.
@udfalkso Yeah, in your case yes. But the packager uses your .babelrc instead if you have one, or at least that's how it used to be. I haven't tried with a custom .babelrc in the latest version though.
I'm using an empty .babelrc file, but using es6 modules and other things. So I assume RN packager is picking up the rest of the slack. Finally all working now.
I found this issue when having braces in place for destructuring, but without any values between the braces.
e.g. const value = ({}) => { ... }
I believe Babel is simply complaining that the object is in fact empty, and does not have any values to destructure.
Reacted by Denis Jacquemin, garrettmac, Oboo Cheng, Tianhao Zhou, Satya Prakash Goyal, Tomáš Hromada, Paulo Cesar, Jimmy Nordbeck, Ben Clayton, Michael Leung and 17 more
Reacted by Oboo Cheng, Yuta Igarashi, Eduardo V., alexz, Guillermo Moratorio, Krisid Misso and Luis Eduardo Brito
I am also experiencing this error when I Run and Build my react native app on XCode.
[error][tid:com.facebook.react.JavaScript] babelHelpers.objectDestructuringEmpty is not a function. (In 'babelHelpers.objectDestructuringEmpty(o.default)', 'babelHelpers.objectDestructuringEmpty' is undefined)
I already tried all the solutions here but still facing the problem.
It's a shame that the only fix here is "don't do that." Empty destructuring is perfectly valid, and it could be a nice idiom for ignoring an argument, as in ({}, foo) => .... In fact, the Babel helper in question exists specifically to allow destructuring an empty object in a spec-compliant way: babel/babel#681
My issue was an empty destructuring for the arguments of a function. What's interesting is this was only an issue when I did a production build. In my iOS emulator I didn't get an exception.
Activity
facebook-github-bot commentedon Dec 16, 2015
Hey cancan101, thanks for reporting this issue!
React Native, as you've probably heard, is getting really popular and truth is we're getting a bit overwhelmed by the activity surrounding it. There are just too many issues for us to manage properly.
react-nativeor for more real time interactions, ask on Discord in the #react-native channel.udfalkso commentedon Dec 21, 2015
Hi @cancan101 I'm also hitting this issue. Did you manage to solve it? Thanks
cancan101 commentedon Dec 21, 2015
Try adding
"transform-runtime"to the plugins.udfalkso commentedon Dec 21, 2015
Thanks. Did you have to add babel-runtim@6.x to your package file to get this to work? (See: https://phabricator.babeljs.io/T2759)
I've tried that and now I get this problem:
But this file is there.
udfalkso commentedon Dec 21, 2015
@cancan101 Any chance you could share what's in your package.json and .babelrc files? Would be very helpful, thanks!
udfalkso commentedon Dec 22, 2015
Finally managed to get past this error. It turns out that I had code like this that needed to be removed:
cancan101 commentedon Dec 22, 2015
That worked for me as well.
cancan101 commentedon Dec 22, 2015
Is this some sort of know issue ? How did you figure it out.
udfalkso commentedon Dec 22, 2015
Just a lot of digging around and trial and error.
satya164 commentedon Dec 22, 2015
You seem to be using very few transforms, and missing lots of transforms like destructuring, which might be causing the issue. It'll be better to copy/extend React Native's
.babelrcand add what you need.udfalkso commentedon Dec 22, 2015
Aren't those transforms automatically being run by the RN packager @satya164 ? This was a special case of destructuring an empty object which I think caused the problem here.
satya164 commentedon Dec 22, 2015
@udfalkso Yeah, in your case yes. But the packager uses your
.babelrcinstead if you have one, or at least that's how it used to be. I haven't tried with a custom.babelrcin the latest version though.cancan101 commentedon Dec 23, 2015
Right now I am using a
.babelrcof:{ "presets": [], "plugins": [ "transform-decorators-legacy", "transform-export-extensions" ] }and it works as long as I remove all instances of:
udfalkso commentedon Dec 23, 2015
I'm using an empty .babelrc file, but using es6 modules and other things. So I assume RN packager is picking up the rest of the slack. Finally all working now.
3 remaining items
philolo1 commentedon Sep 18, 2016
I had a similar issue because I used
{}at some point, is this an issue with babel, and if so which repo should we report it.MutableLoss commentedon Jan 10, 2017
I found this issue when having braces in place for destructuring, but without any values between the braces.
e.g.
const value = ({}) => { ... }I believe Babel is simply complaining that the object is in fact empty, and does not have any values to destructure.
sujitpk-perennial commentedon Oct 26, 2017
For me adding extra curly bracket causing this issue. so I have changed
from renderTextInput= {({}) => ()}
to renderTextInput= {() => (})
alexthegoodman commentedon Nov 3, 2017
I too fell down this trap! Yes, you may use an empty object {}, but are you sure you aren't having a syntax error like:
let { } = this.props;
That's what got me!
patrickleemsantos commentedon Nov 27, 2017
Hi Guys,
I am also experiencing this error when I Run and Build my react native app on XCode.
[error][tid:com.facebook.react.JavaScript] babelHelpers.objectDestructuringEmpty is not a function. (In 'babelHelpers.objectDestructuringEmpty(o.default)', 'babelHelpers.objectDestructuringEmpty' is undefined)
I already tried all the solutions here but still facing the problem.
HananeAlSamrout commentedon Dec 5, 2017
i had this issue also, the reason was
let {}=this.statemckrava commentedon Dec 24, 2017
let { } = some_object;This "empty definition" in any place of code is a reason of babel error.
dgreensp commentedon Apr 10, 2018
It's a shame that the only fix here is "don't do that." Empty destructuring is perfectly valid, and it could be a nice idiom for ignoring an argument, as in
({}, foo) => .... In fact, the Babel helper in question exists specifically to allow destructuring an empty object in a spec-compliant way: babel/babel#681punksta commentedon Apr 20, 2018
I had similar problem:
it works good in debug, but release build chased.
fixed by changing
{}to_.vigneshprabhu20 commentedon May 23, 2018
I got this fix upon installing babel helper plugin.
Package.json:
"devDependencies": {
"babel-cli": "6.26.0",
"babel-plugin-external-helpers": "^6.22.0",
....
}
babelrc:
{
"presets": ["react-native", "flow"],
"plugins": [
"external-helpers",
...
]
}
Reference to install this plugin:
https://www.npmjs.com/package/babel-plugin-external-helpers
RossKinsella commentedon Jun 7, 2018
My issue was an empty destructuring for the arguments of a function. What's interesting is this was only an issue when I did a production build. In my iOS emulator I didn't get an exception.
ishigamii commentedon Jun 12, 2018
@vigneshprabhu20 I just tried your solution and sadly I still have the same problem.
I fixed my problem thanks to your comments.
My problem was that one of my render was like this :
_renderHeader = ({}) => {...}and it should be like this :
_renderHeader = () => {...}A fix is really needed for this 👍
ramonprata commentedon Jun 25, 2018
tks @vigneshprabhu20 you solution worked for me