graphql js stuff in final bundle
See original GitHub issueSteps to reproduce
I’m trying “@urql/svelte”: “0.1.3” and it works great!
Expected behavior
I’m also using babel-plugin-graphql-tag
and it work if I remove urql
(using let’s say Apollo with the same queries).
Actual behavior
If I just add initClient()
in my App.svelte
the final bundle contains graphql
js too in it (42 KB!).
How to fix it?
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Webpack puts multiple copies of `graphql` in the bundle ...
Hello I'm attempting to set up a project using apollo-server-lambda, but I'm encountering the following issue when initializing the ...
Read more >GraphQL Code Libraries, Tools and Services
A JavaScript library for application development using cloud services, which supports GraphQL backend and React components for working with GraphQL data.
Read more >Full Stack Error Handling with GraphQL and Apollo
As a package author, I would like to be able to write components/middleware that could handle errors automatically in the most appropriate way....
Read more >5 GraphQL clients for JavaScript and Node.js - LogRocket Blog
Unlike REST APIs, GraphQL uses a single endpoint for all operations. GraphQL-based servers can only communicate via GraphQL queries. For simple ...
Read more >How to Get Started with GraphQL and Node.js - freeCodeCamp
REST has been a popular way to expose data from a server. But instead of having multiple endpoints that return fixed data structures,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yes, the difference is mostly that Apollo now enforced the usage of
graphql-tag
. They even export thegql
tag themselves.But
urql
also supports just passing in the query trying directly (which is actually used really frequently) withoutgraphql-tag
So that means we always include
parse
fromgraphql
.Afaik though, a caveat here is that the Babel plugin is nice to speed up parsing time. That’s not really an issue though because it always only happens once. Eventually though the plugin doesn’t save you any size anymore as with multiple queries over time the size of the parsed GraphQL Query AST overtakes the size of the tagged / string variants
The main part why these are still included is because we don’t enforce the usage of
graphql-tag
as you can see here https://github.com/FormidableLabs/urql/blob/master/packages/core/src/utils/request.ts#L21This won’t bee tree-shaken out since it’s a runtime process