-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Latest version of React Native + Apollo Stack doesn't work. #261
Comments
Just figured out the issue. It's very strange. "npm install" creates a sub-node_modules folder inside the "APP/node_modules/graphql/" module directory. Deleting this second node_modules folder from the graphql folder will make the app work again. Inside this inner node_modules folder, there are 2 packages -- babel-runtime and core-js. Deleting these make the apollo app work again. |
@saeho Is this something we can fix with a prepublish or postinstall script, or is it an npm issue we have no control over? |
I'm trying to figure this out too. The reason why I'm posting this here is because I think it's an apollo issue. Apollo used to work in the React Native app I'm working on at one point. Then after some upgrades (don't know which package), I learned that my co-workers cannot fresh-install the app and make it run with npm install. The package causing this issue as I said above is the graphql package. And Apollo-client/react-apollo is the only graphql related package in my react-native app. (Server is in a completely different repo so no server graphql packages can be causing this). |
This sounds a lot like an npm issues (npm has so many issues... ), but there may be a workaround. If you could make a github repo with a minimal reproduction, then we might have a chance at figuring out whether there's a fix we can do in apollo client, or whether this needs to be fixed in graphql-js. |
@saeho can you post your npm and node version. Seems like an npm2 artifacts. Npm3 normally flatten the tree. |
npm 3.8.6 |
Perhaps And then maybe when you delete that package, it still runs fine because the GraphQL parser (the only part of That could be one explanation. |
That's probably what's happening. But the question is not why it breaks, but why it's happening. |
Why would graphql depend on babel-runtime? (except during development) Maybe this is an extraneous dependency in graphql, and could be removed there? From what I understand, babel-runtime gets compiled into the app during build, so there should be no runtime dependency on any babel packages. |
After some digging around, I came to the conclusion that graphql's babel-runtime dependency is causing this issue. Can we please remove it from the its dependencies? |
I think a good choice would be submitting a PR to graphql-js to remove the dependency on |
@saeho Any news on this? Did you file an issue or make a PR to graphql-js? |
followed the same steps as @saeho, but got this error:
It's when using object-assign in connect.js in react-apollo, so issue probably belongs in that repo. But you didn't receive this error? React native doesn't like modules to use object-assign-polyfill? |
Did you get this to work @saeho ? Seems like babel-deps that graphql needs breaks react native packaging. EDIT: Seems like apollostack doesn't like immutable data. So that was my issue |
I also have the same issue, @saeho ! Do you want me to file an issue ? |
Is there any update on this issue ? I read on Slack that @stubailo wanted to take a closer look and fix any remaining issue with RN. Did you had a chance to do it yet ? |
OK here's the plan: We're going to bundle just the @abhiaiyer91 is going to take a stab at it, and we'll see if we can get it done today. |
👋👋
|
@stubailo @abhiaiyer91 : i started to investiguate this solution last week so maybe I can help. But are you sure you wan't to maintain a fork for those two functions if graphql agrees to split package and remov the hard dependencie to async in the parser build. |
@tychota yes ideally we would want graphql to be more modular in their export. I also even tried to attempt the solution like that, but since we use these 2 functions only, I felt that it was too much work to sign up for to unblock our project Here is the PR. We just bundle parser and printer, and if graphql does change this we can always rebundle. |
OK, I believe we have conclusively fixed this issue in Apollo Client version |
Following this example I'm able to get Apollo working:
#147 (comment)
But then, this happens:
Thus the React Native app cannot run with Apollo.
The text was updated successfully, but these errors were encountered: