question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

graphql js stuff in final bundle

See original GitHub issue

Steps 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!).

image

How to fix it?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
kittencommented, Apr 17, 2020

Yes, the difference is mostly that Apollo now enforced the usage of graphql-tag. They even export the gql tag themselves.

But urql also supports just passing in the query trying directly (which is actually used really frequently) without graphql-tag

So that means we always include parse from graphql.

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

1reaction
JoviDeCroockcommented, Apr 17, 2020

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#L21

This won’t bee tree-shaken out since it’s a runtime process

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found