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.

3.1.0-pre.0 bundle size regression with rollup

See original GitHub issue

I know this is prerelease but I just want to give some feedback. This is the same as a comment I made in https://github.com/apollographql/apollo-client/commit/faa64b303447e0d5c745ec27cdd2480338c3763a#r40855898 but I created an issue for more visibility. I tried out 3.1.0.pre.0 and we are seeing a bundle size regression in our rollup bundle. Here is a snippet from dist/core/index.js before and after

export { ApolloClient, } from './ApolloClient';
export { ObservableQuery, } from './ObservableQuery';
export { NetworkStatus } from './networkStatus';
export * from './types';
export { isApolloError, ApolloError } from '../errors';
import '../utilities/graphql/directives.js';
import '../utilities/graphql/fragments.js';
export { isReference, makeReference } from '../utilities/graphql/storeUtils.js';
import '../utilities/graphql/getFromAST.js';
import '../utilities/graphql/transform.js';
export { default as Observable } from 'zen-observable';
import '../utilities/common/mergeDeep.js';
import '../utilities/common/cloneDeep.js';
import '../utilities/common/maybeDeepFreeze.js';

I don’t think rollup is able to treeshake the imports with no specifiers. Please let me know if you need any more info if there are any workarounds.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
benjamncommented, Jul 23, 2020

@henryqdineen This is great feedback, and really validates the decision to publish -pre.0 before 3.1.0!

I was uneasy with those specifier-less imports too, and couldn’t find a combination of Rollup options to prevent them. I think they have something to do with import hoisting, which is supposedly disabled when preserveModules: true is set (which we do), but apparently not? Ironically, Rollup seems to be creating a problem that it can’t solve (tree-shake) later.

In any case, I am planning to replace resolveESMImportsAndFileExtensions with a step that simply resolves all existing module identifiers, without injecting any new imports or exports.

0reactions
henryqdineencommented, Jul 27, 2020

@benjamn I just tried it out by adding "sideEffects": false to node_modules/graphql-tag/package.json and that did the trick! Are there plans to add that flag to that project? The other solution would work also but seems like a breaking change since we are removing named exports. Thanks as usual!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Investigate bundle size regression · Issue #157 - GitHub
For the moment, I've updated Rollup to the latest release and tweaked the domHelpers util a bit (7130e03). I think the size increase...
Read more >
@bugsnag/plugin-node-in-project | Yarn - Package Manager
This plugin detects whether a stackframe is "in project" – i.e. whether it is a descendent of the project root and node within...
Read more >
ng-packagr/CHANGELOG.md - UNPKG
44, * update @rollup/plugin-node-resolve to version ^9.0.0 ... 1164, * reduce library bundle size by clean-css ... 1536, * regression in cli defaults ......
Read more >
Webpack vs Rollup vs Parcel vs Browserify — Bundle size ...
Build time, bundle size and ease of use comparison between JavaScript bundlers Webpack, Rollup, Parcel and Browserify.
Read more >
Updates - CodeKit
23 September 2022. Build 34434 — Download. Bootstrap: The JS file that bundles Bootstrap components is now named so that you can ...
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