Comments (10)
I'm happy with that so long as the bundle size stays below 15kb 👍 thanks!
from graphql-request.
Interesting! I'll give it a look. Thanks!
from graphql-request.
Super! Verified with my reproduction and it's back down to 12.6 KiB. Thank you!
from graphql-request.
Thanks for reporting this. Related issue: graphql/graphql-js#1272
@timsuchanek : We need just the print function from graphql-js
, extracting that inline will remove the graphql
dependency and reduce bundle size. Sounds good?
I will also add bundle size check in CI.
from graphql-request.
Added bundlesize
to CI here: #96
It is still under 3 KB
, of course it is not counting the peer dep size.
Is it possible for you to configure webpack to not include unused code from peer dep?
from graphql-request.
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.
from graphql-request.
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 bundlesize
check is CI passes. Also, the size reported by bundlephobia is under 15 KB as you had originally asked for.
from graphql-request.
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 print
from graphql
which is what's causing the issues. If I remove the line import { print } from 'graphql'
then the size goes down to 12.6 KiB.
I don't think it's possible to import print
from graphql
and keep the filesize down because print
requires a LOT of code. And it's impossible to tree-shake that because it's used in the source code. I mean, you could restructure the code so folks who want that support can import another file or something, but I think that would be pointless because people who use that don't care about size and can therefore use another package altogether.
from graphql-request.
@kentcdodds: Thanks for working with me on this one and providing the reproduction. This PR reverts this feature: #97
Further actions for me:-
-
- Create issue for reliably detecting bundle size in CI to avoid this regression in future, both
bundlephobia
andbundlesize
didn't work forgraphql
being a peer dependency.
- Create issue for reliably detecting bundle size in CI to avoid this regression in future, both
-
- Reopen the issue #10
Thanks!
from graphql-request.
This is release in 1.8.1 🎉
from graphql-request.
Related Issues (20)
- Extension to bring back file upload support
- How do get the IP address of the client in the request middleware?
- I want the GraphQLClient instance to return response headers along with data HOT 2
- Include a new option to ignore operationName to avoid parsing for extraction. HOT 1
- How to pass headers while using `getServerSideProps` HOT 1
- Image Upload HOT 1
- Dynamic Headers: use async function to get headers HOT 2
- TypeError: response.headers.forEach is not a function HOT 1
- `client.request()` does not take a `signal` option as shown in examples HOT 2
- Invalid execution result: data is not plain object HOT 6
- ts-client custom scalars
- Support passing relative path for URL HOT 7
- Variables typing gives unexpected error HOT 1
- `TypeError: Only absolute URLs are supported` when testing with jsdom. HOT 2
- Link to custom fetch function in README.md is not working
- Prevent request in request middleware and return some cached response
- Access request options in responseMiddleware HOT 3
- Add request headers to a client error in a response middleware HOT 3
- Memoizing fetch error: Body is unusable
- jsonSerializer: fetchOptions.jsonSerializer ?? defaultJsonSerializer_js_1.defaultJsonSerializer, ^ SyntaxError: Invalid or unexpected token at Module._extensions..js (node:internal/modules/cjs/loader:1295:10) HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphql-request.