babelHelpers.objectDestructuringEmpty is not a function


#1

I’m running the latest version of Expo (25.0.0) and everything seems to be working fine when running locally on both device and simulator.

When I publish the app to Expo (exp publish --release-channel staging) and install the app on my iPad with the Expo app I get a white screen after login.

I’ve debugged the app by using idevicesyslog and the error seems to be TypeError: babelHelpers.objectDestructuringEmpty is not a function. (In 'babelHelpers.objectDestructuringEmpty(e)', 'babelHelpers.objectDestructuringEmpty' is undefined)

Anyone having similar issues?


#2

Hey @tommyy - I did some googling and found this thread with your same error: https://github.com/facebook/react-native/issues/4831 . It looks like you have an empty destructured object in your code (e.g. const { } = anObject). See if you have that or any of the other examples in the thread I linked – fixing it will hopefully make the error go away.


#3

Hey @esamelson, thanks for answering.

I suspect that this empty destructured object is a result of babel, as I can’t find it in my code.
I’ve rolled back to an earlier commit in my code, hence running an earlier version of Expo and misc libraries, and it works. Will upgrade step by step to see what the issue is.

Thanks.


#4

We’re running into the same issue, on dev everything works fine but when we use a release channel it no longer supports destructuring. I’m currently looking into how to add the destructuring babel transform for staging builds in a hope to resolve this.


#5

@walden-cohere - can you share how do your staging builds? eg: do you do NODE_ENV=staging exp build ...? also, can you share your babelrc?


#6

We are using exp publish --release-channel=staging for our staging builds, and the babelrc is as follows:

{
  "presets": ["babel-preset-expo"],
  "env": {
    "development": {
      "plugins": ["transform-react-jsx-source"]
    }
  }
}

#7

looks right to me. are you sure that it’s only on staging channel where this error occurs? it’s possible some changes since you last deployed to your other channels impacted this


#8

To clarify, it may not be working on any of the other channels (We only have pre-staging and staging at the moment).

To clarify, this functions while in development but does not function when building for staging. I’m still spelunking through the presets and source code to try and identify if there are any points where Expo does different things with babel when the release channel is set; but it’s taking me a while since I am not familiar with Expo’s codebase (yet)


#9

I was able to isolate the attempt to destructure an empty argument to a a functional component that was defined as ({}) => { ... }.

For those who come after, it may be worth searching your codebase for ({}) => if you wind up encountering this error.

Ultimately, I believe the difference in ES support between standard local builds and in-channel builds is quite surprising. I am not entirely sure what the cause was (still) but I have some theories:

  • Perhaps minification discarded the objectDestructuringEmpty function?
  • Perhaps the empty destructuring is a devDependency of some up or downstream package that does not get included when building using exp publish

I don’t have the time to dive into the particulars, but appreciate the support @notbrent!


#10

I got my project working as well, and had the same issue as walden-cohere. Had a ({}) => { ... } hidden somewhere in my code.


closed #11

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.