Skip to content
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

Add babel-plugin-modular-graphql to rewrite graphql imports #700

Merged
merged 2 commits into from
Apr 16, 2020

Conversation

kitten
Copy link
Member

@kitten kitten commented Apr 15, 2020

Adds babel-plugin-modular-graphql to rewrite graphql imports to their modular variants.

@changeset-bot
Copy link

changeset-bot bot commented Apr 15, 2020

🦋 Changeset is good to go

Latest commit: c3fa0d7

We got this.

This PR includes changesets to release 3 packages
Name Type
@urql/exchange-graphcache Patch
@urql/exchange-populate Patch
@urql/core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@kitten
Copy link
Member Author

kitten commented Apr 16, 2020

Some quick bundlesize smoke tests:

So it seems that this indeed benefits some parts of our build, namely graphcache, but not all.

Edit: I'm currently evaluating which parts of the graphql package we should be including, ignoring Graphcache, and found the following:

  • print from graphql/language/printer (1.46kB minzipped)
    • blockString from graphql/language/blockString (542B minzipped)
  • visit from graphql/language/visitor (1.5kB minzipped, print depends on this)
  • Kind from graphql/language/kinds (599B minzipped)
  • GraphQLError from graphql/error/GraphQLError (1.76kB minzipped)
    • graphql/jsutils/isObjectLike (239B minzipped)
    • graphql/language/location (212B minzipped)
    • graphql/language/printLocation (583B minzipped)
  • parse from graphql/language/parser (3.37kB minzipped)
    • inspect from graphql/jsutils/inspect (794B minzipped)
    • graphql/jsutils/inspect (749B minzipped)
    • graphql/jsutils/devAssert (145B minzipped)
    • graphql/error/syntaxError (181B minzipped)
    • graphql/language/source (322B minzipped)
      • graphql/polyfills/symbols (234B minzipped)
    • graphql/language/tokenKind (303B minzipped)
    • graphql/language/lexer (2.21kB minzipped)
    • graphql/language/ast (374B minzipped)
      • graphql/jsutils/defineToJSON (255B minzipped)

If I haven't forgotten any this adds up to around: 15.72kB (not-minzipped but should be an upper boundary). I might've forgotten something, but the estimate from webpack-bundle-analyzer actually comes down to 9.08kB for the included graphql modules, which seems realistic and good.

@kitten kitten merged commit 268d880 into master Apr 16, 2020
@kitten kitten deleted the chore/modular-graphql-imports branch April 16, 2020 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants