Skip to content

babelHelpers.objectDestructuringEmpty is not a function #4831

Closed
@cancan101

Description

@cancan101

I upgraded from RN 15 to RN 16 and now I get:
babelHelpers.objectDestructuringEmpty is not a function:
image

Currently my .babelrc files looks like:

{
  "presets": ["react"],
  "plugins": [
    "transform-decorators-legacy",
    "transform-es2015-classes",
    "transform-export-extensions"
  ]
}

I previously also had es2015 in the presets list but then I got: http://stackoverflow.com/questions/34112110/upgrade-to-react-native-0-16-error.

Activity

facebook-github-bot

facebook-github-bot commented on Dec 16, 2015

@facebook-github-bot
Contributor

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.

  • 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!
udfalkso

udfalkso commented on Dec 21, 2015

@udfalkso

Hi @cancan101 I'm also hitting this issue. Did you manage to solve it? Thanks

cancan101

cancan101 commented on Dec 21, 2015

@cancan101
ContributorAuthor

Try adding "transform-runtime" to the plugins.

udfalkso

udfalkso commented on Dec 21, 2015

@udfalkso

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:

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)

But this file is there.

(develop)[udi@udis-mac:node_modules/babel-runtime]$ find . -name "*min-safe-integer*" -print
./core-js/number/min-safe-integer.js
./node_modules/core-js/fn/number/min-safe-integer.js
./node_modules/core-js/library/fn/number/min-safe-integer.js
./node_modules/core-js/library/modules/es6.number.min-safe-integer.js
./node_modules/core-js/modules/es6.number.min-safe-integer.js
udfalkso

udfalkso commented on Dec 21, 2015

@udfalkso

@cancan101 Any chance you could share what's in your package.json and .babelrc files? Would be very helpful, thanks!

udfalkso

udfalkso commented on Dec 22, 2015

@udfalkso

Finally managed to get past this error. It turns out that I had code like this that needed to be removed:

var {
} = React;
cancan101

cancan101 commented on Dec 22, 2015

@cancan101
ContributorAuthor

That worked for me as well.

cancan101

cancan101 commented on Dec 22, 2015

@cancan101
ContributorAuthor

Is this some sort of know issue ? How did you figure it out.

udfalkso

udfalkso commented on Dec 22, 2015

@udfalkso

Just a lot of digging around and trial and error.

satya164

satya164 commented on Dec 22, 2015

@satya164
Contributor

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.

udfalkso

udfalkso commented on Dec 22, 2015

@udfalkso

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

satya164 commented on Dec 22, 2015

@satya164
Contributor

@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.

cancan101

cancan101 commented on Dec 23, 2015

@cancan101
ContributorAuthor

Right now I am using a .babelrc of:

{
  "presets": [],
  "plugins": [
    "transform-decorators-legacy",
    "transform-export-extensions"
  ]
}

and it works as long as I remove all instances of:

const {
} = React;
udfalkso

udfalkso commented on Dec 23, 2015

@udfalkso

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.

21 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @cancan101@brentvatne@dgreensp@alexthegoodman@satya164

        Issue actions

          babelHelpers.objectDestructuringEmpty is not a function · Issue #4831 · facebook/react-native