Skip to content
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

Doesn't work with React Native #4

Open
cooperka opened this issue Apr 28, 2017 · 3 comments
Open

Doesn't work with React Native #4

cooperka opened this issue Apr 28, 2017 · 3 comments

Comments

@cooperka
Copy link

cooperka commented Apr 28, 2017

I got a very similar issue to #2 using React Native v0.43. After some testing, it turns out this plugin doesn't work at all with React Native :(

Property property of MemberExpression expected node to be of a type ["Identifier"] but instead got "BinaryExpression"

Working demo project: https://github.com/cooperka/DemoDevExpression

Full stack:

error: bundling: TypeError: /Users/me/dev/apps/my-app/node_modules/react-native/packager/src/Resolver/polyfills/prelude_dev.js: Property property of MemberExpression expected node to be of a type ["Identifier"] but instead got "BinaryExpression"
    at validate (/Users/me/dev/apps/my-app/node_modules/babel-types/lib/definitions/index.js:109:13)
    at Object.validate (/Users/me/dev/apps/my-app/node_modules/babel-types/lib/definitions/core.js:412:50)
    at Object.validate (/Users/me/dev/apps/my-app/node_modules/babel-types/lib/index.js:505:9)
    at NodePath._replaceWith (/Users/me/dev/apps/my-app/node_modules/babel-traverse/lib/path/replacement.js:176:7)
    at NodePath.replaceWith (/Users/me/dev/apps/my-app/node_modules/babel-traverse/lib/path/replacement.js:160:8)
    at PluginPass.enter (/Users/me/dev/apps/my-app/node_modules/babel-plugin-dev-expression/dev-expression.js:41:18)
    at newFn (/Users/me/dev/apps/my-app/node_modules/babel-traverse/lib/visitors.js:276:21)
    at NodePath._call (/Users/me/dev/apps/my-app/node_modules/babel-traverse/lib/path/context.js:76:18)
    at NodePath.call (/Users/me/dev/apps/my-app/node_modules/babel-traverse/lib/path/context.js:48:17)
TransformError: /Users/me/dev/apps/my-app/node_modules/react-native/packager/src/Resolver/polyfills/prelude_dev.js: /Users/me/dev/apps/my-app/node_modules/react-native/packager/src/Resolver/polyfills/prelude_dev.js: Property property of MemberExpression expected node to be of a type ["Identifier"] but instead got "BinaryExpression"
Bundling `index.ios.js`  100.0% (1991/1991), failed.

.babelrc:

{
  "presets": ["react-native"],
  "plugins": ["dev-expression"]
}

Any idea what's going on or how to fix it?

@cooperka cooperka changed the title Don't work with React Native Doesn't work with React Native Apr 28, 2017
@taion
Copy link
Contributor

taion commented Apr 26, 2018

Hmm, I think this is picking up on object keys that are __DEV__.

@jquense
Copy link
Member

jquense commented Apr 26, 2018

it does do that, i've had to do { '__DEV__': true } to trick it...

@taion
Copy link
Contributor

taion commented Apr 26, 2018

yeahhhhh what do you think are the odds that they'll accept a PR to fix this upstream? or should we make this an actual fork instead of a copy/paste?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants