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

Make further bundle size optimisations #375

Merged
merged 8 commits into from
Aug 12, 2019

Conversation

kitten
Copy link
Member

@kitten kitten commented Aug 6, 2019

This accomplishes a couple of things.

Firstly it sets up Rollup to compile process.env.NODE_ENV to be "production" for our minified bundles so those accurately reflect what urql would compile to in a production environment.

Then it adds some initial bundle size optimisations:

  • Remove rest spread from Query/Subscription components as it's not needed
  • Replace debugExchange with a noop in production
  • Remove usage of addMetadata with latency times from fetchExchange in production
  • Remove fallback and fetch error for unknown operations in production
  • Extract response/error parsing from fetchExchange and subscriptionExchange into a common file

This appears to currently save us about 0.3kB (4.62 kB => 4.32kB) min+gzip

@JoviDeCroock
Copy link
Collaborator

I think this in combination with the removal of graphql-tag will drop the bundle size on phobia down by quite a good margin. I think it's ready personally don't see that much aspects to make it smaller atm (apart from things that reduce readability). We could also mangle really internal properties

@kitten kitten changed the title WIP: Make further bundle size optimisations Make further bundle size optimisations Aug 12, 2019
@kitten kitten marked this pull request as ready for review August 12, 2019 12:37
@JoviDeCroock JoviDeCroock merged commit f30b28f into master Aug 12, 2019
@JoviDeCroock JoviDeCroock deleted the chore/aggressive-bundling branch August 12, 2019 12:38
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