Apollo-client: Cannot find module `apollo-client/gql`

Created on 28 Jun 2016  路  16Comments  路  Source: apollographql/apollo-client

Like #186, apollo-client#0.3.21 seems to not have the right module resolution on gql.

Can you publish a corrected version please ?

Also this is related to #188.

Thanks to @pschupp01 for indentifying the bug.

All 16 comments

You're right! I just realized the issue, will publish a fix in 10 minutes.

Isn't the _fix_ that gql is now in its own repo and you have to do this?

import gql from 'graphql-tag';

That is not an acceptable fix because what you are suggesting is there has been a major API change and you just incremented a PATCH number (see semver http://semver.org/). To actually tell you what happened on our side is that we had a major breakage because npm considered it was ok to go to 0.3.21.

By the way, you should emit a deprecation warning when people are trying to import apollo-client/gql if you want to deprecate it. I could actually do a PR for that if you want.

@rricard I agree, the proper way to fix things now is probably to re-introduce it in 0.3.22, and then remove it for 0.4.0. But maybe @stubailo has something else in mind, like importing it in apollo-client and exporting it again from there.

I think that's better. React warns breaking changes mostly like this and it works really well!

@rricard send over that deprecation warning PR!! :)

@abhiaiyer91: when I'll have some time but if there is some stuff to revert back, I think it's better that the @apollostack's team takes care of it

This was an accidental change. I had no intention to break importing from apollo-client/gql in this version.

Okay, I'll just do a deprecation warning PR then!

@rricard yes please, it would go here: https://github.com/apollostack/apollo-client/blob/master/gql.js

Is there any way to avoid printing the warning in production?

mheh, I know that React and Redux remove warnings on prod but I don't think it's easy to do, they have a really different build system and I have to admin I'm not an expert with tsc

I think it's up to the user's build system. Perhaps if we just do if (process.env.NODE_ENV === 'production') that will be good enough.

I was leaning towards that by looking at redux. But it should be noted that redux uses webpack's DefinePlugin for UMD builds ...

I think those if statements are evaluated by the app using the package, at the minification step. Like, when you npm install react it comes with all of the debug stuff, I'm pretty sure it's up to your minifier to remove it.

Hey, I published a fix as version 0.3.24.

This kind of problem is exactly why we are moving it into a different package - I'd prefer not to have to deal with moving around folders when publishing the package, which is what we had to do to achieve the apollo-client/gql module.

So hopefully @rricard you can add the deprecation warning for 0.3.x, and in 0.4.x we will get rid of it in favor of the new graphql-tag package.

Was this page helpful?
0 / 5 - 0 ratings