Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.

zen-observable breaks while compiling. #389

Closed
VrajSolanki opened this issue Jan 5, 2018 · 13 comments
Closed

zen-observable breaks while compiling. #389

VrajSolanki opened this issue Jan 5, 2018 · 13 comments
Labels

Comments

@VrajSolanki
Copy link

VrajSolanki commented Jan 5, 2018

Intended outcome:

I updated the apollo-client and added apollo-link to my React-Native app. But the apollo-link breaks during compiling phase, but I expected the app to run smoothly as I have already updated the same in another react app.

react-native version : 0.49.1
apollo-link version: 1.0.7

Code for apollo Client

import { ApolloClient } from 'apollo-client'
import { HttpLink, createHttpLink } from 'apollo-link-http';
import { setContext } from 'apollo-link-context';
import { InMemoryCache, IntrospectionFragmentMatcher } from 'apollo-cache-inmemory';
import schema from './schema.json'

const httpLink = createHttpLink({ uri: `localhost:3000/graphql` });

const cache = new InMemoryCache({
  fragmentMatcher: new IntrospectionFragmentMatcher({
    introspectionQueryResultData: schema.data
  }),
});

const client = new ApolloClient({
  link: httpLink,
  cache: cache,
});

export default client

Actual outcome:
screen shot 2018-01-05 at 8 32 41 pm

error: bundling failed: TypeError: pathToNodeModules/node_modules/zen-observable/zen-observable.js: Property left of AssignmentExpression expected node to be of a type ["LVal"] but instead got "ConditionalExpression"
    at Object.validate (pathToNodeModules/node_modules/babel-types/lib/definitions/index.js:109:13)
    at Object.validate (pathToNodeModules/node_modules/babel-types/lib/index.js:505:9)
    at NodePath._replaceWith (pathToNodeModules/node_modules/babel-traverse/lib/path/replacement.js:176:7)
    at NodePath.replaceWith (pathToNodeModules/node_modules/babel-traverse/lib/path/replacement.js:160:8)
    at PluginPass.MemberExpression (pathToNodeModules/node_modules/babel-preset-react-native/transforms/transform-symbol-member.js:33:14)
    at newFn (pathToNodeModules/node_modules/babel-traverse/lib/visitors.js:276:21)
    at NodePath._call (pathToNodeModules/node_modules/babel-traverse/lib/path/context.js:76:18)
    at NodePath.call (pathToNodeModules/node_modules/babel-traverse/lib/path/context.js:48:17)
    at NodePath.visit (pathToNodeModules/node_modules/babel-traverse/lib/path/context.js:105:12)
error: bundling failed: TypeError: pathToNodeModules/node_modules/zen-observable/zen-observable.js: Property left of AssignmentExpression expected node to be of a type ["LVal"] but instead got "ConditionalExpression"
    at Object.validate (pathToNodeModules/node_modules/babel-types/lib/definitions/index.js:109:13)
    at Object.validate (pathToNodeModules/node_modules/babel-types/lib/index.js:505:9)
    at NodePath._replaceWith (pathToNodeModules/node_modules/babel-traverse/lib/path/replacement.js:176:7)
    at NodePath.replaceWith (pathToNodeModules/node_modules/babel-traverse/lib/path/replacement.js:160:8)
    at PluginPass.MemberExpression (pathToNodeModules/node_modules/babel-preset-react-native/transforms/transform-symbol-member.js:33:14)
    at newFn (pathToNodeModules/node_modules/babel-traverse/lib/visitors.js:276:21)
    at NodePath._call (pathToNodeModules/node_modules/babel-traverse/lib/path/context.js:76:18)
    at NodePath.call (pathToNodeModules/node_modules/babel-traverse/lib/path/context.js:48:17)
    at NodePath.visit (pathToNodeModules/node_modules/babel-traverse/lib/path/context.js:105:12)
  
  
@hameltomor
Copy link

+1 the same problem

@evans evans added the bug label Feb 14, 2018
@stefanoTron
Copy link

+1

3 similar comments
@Rahulkr204
Copy link

+1

@damini37
Copy link

+1

@ashishsingh2637
Copy link

+1

@stefanoTron
Copy link

might this be related to #489 ?

@cranberyxl
Copy link

Has anyone come up with a react-native workaround?

@fbartho
Copy link
Contributor

fbartho commented Feb 20, 2018

Does not occur on later versions of React-Native

@cranberyxl
Copy link

cranberyxl commented Feb 20, 2018

Error has changed files to:

/node_modules/apollo-link/node_modules/zen-observable/lib/Observable.js: Property left of AssignmentExpression expected node to be of a type ["LVal"] but instead got "ConditionalExpression"

Using:

react-native 0.53.3
apollo-link 1.2.0

@stefanoTron
Copy link

still getting an error with 1.2.0 😢 but I'm using in a Vuejs app.

TypeError: _super.call is not a function
    at new ObservableQuery
    at QueryManager.watchQuery 
    at eval 
    at new Promise 
    at QueryManager.query 
    at ApolloClient.query
    at VueComponent.created

this seems to be tracked here apollographql/apollo-client/issues/2785 as well

@VrajSolanki
Copy link
Author

@fbartho which react-native and apollo-link version are you using?
@evans as @cranberyxl said, same thing is happening to me, the error file changed. Am i missing something here??

RN- Version: 0.53.0
Apollo-link: 1.2.0

@cranberyxl
Copy link

@VrajSolanki Can you try yarn add -D babel-preset-react-native I noticed that react-native-maps was relying on an old version of it and this has fixed it so far.

@radko93
Copy link

radko93 commented Mar 13, 2018

Managed to find a workaround when using yarn (in my case it was probably wrong version of babel-preset-react-native used by some other dependency). Put this in your package.json:

"resolutions": {
    "apollo-client/apollo-link": "^1.2.1",
    "apollo-client/zen-observable": "^0.8.6",
    "babel-preset-react-native": "4.0.0"
  }

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

No branches or pull requests

10 participants