-
Notifications
You must be signed in to change notification settings - Fork 307
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
Two bugs in 1.7.0 due to including graphql dependency. #94
Comments
Thanks for reporting this. Related issue: graphql/graphql-js#1272 @timsuchanek : We need just the print function from I will also add bundle size check in CI. |
I'm happy with that so long as the bundle size stays below 15kb 👍 thanks! |
Added Is it possible for you to configure webpack to not include unused code from peer dep? |
What do you mean? This line is importing the peer dep, so that code is used (though the module may be tree-shaken, that's still a LOT of code). I'm pretty certain that the feature must be dropped entirely. If someone wants that feature then they can use one of the many other libraries that provide this capability... The appeal of graphql-request is its size. If this isn't changed, then I'll probably look for another module or fork this one if I ever need changes, which is fine, I just thought that the goal of this module was to fill the needs of size-conscious people like me. |
It is definitely a goal to maintain the tiny size of this project. Which is why I want to work with you and reliably detect the impact of any dependencies change in CI. Currently, the |
Interesting! I'll give it a look. Thanks! |
Hmm... I updated the example to use 1.8.0 and the bundle size is still the same and I'm still getting the console error. Maybe there's a bug in bundlephobia. The fact is that graphql-request is using I don't think it's possible to import |
@kentcdodds: Thanks for working with me on this one and providing the reproduction. This PR reverts this feature: #97 Further actions for me:-
Thanks! |
This is release in 1.8.1 🎉 |
Super! Verified with my reproduction and it's back down to 12.6 KiB. Thank you! |
This is copy/pasted from a reproduction repository you can checkout :)
graphql-request-1.7.0-bug
This is a reproduction of a bug that came up in 1.7.0.
There are actually 2 bugs IMO.
Bundle Size
In 1.7.0,
graphql-tag
was added as a dependency andgraphql
was added topeerDependencies
. One of the reasons we usegraphql-request
is because it's so small.Here's the webpack output for
graphql-request@1.6.0
:Here's the webpack output for
graphql-request@1.7.0
:Notice the difference in the
main.js
filesize: 12.6 KiB before, 156 KiB after. And this is usingwebpack --mode production
. This is definitely a bug.You can also checkout the built files:
webpack not handling a require statement
I'm honestly not sure what's up here, but if you open up the
index.html
in1.6.0
and open the console there's nothing in there and the code ingraphql-request
runs fine.If you open up the
index.html
in1.7.0
there's the following error in the console:I'm not 100% certain why that's happening, but it's this statement:
I think it's in the
graphql/jsutils/instanceOf.mjs
file where it's usingprocess
. I'm not sure why that's causing issues here...That said, if the first bug is fixed (remove the dependency on
graphql
), then this bug will also be fixed.Thanks!
The text was updated successfully, but these errors were encountered: