-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Apollo Client bundling examples and reporting #5449
Conversation
examples/bundling/no-tree-shaking/rollup-ac3-no-react/package.json
Outdated
Show resolved
Hide resolved
97fe2f1
to
a48dfa9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went ahead and eliminated the graphql-tag
dependency, but I think there's still a CJS/require
issue with bundling for browsers?
input: './src/index.js', | ||
output: { | ||
file: `./public/js/${outputPrefix}.min.js`, | ||
format: 'cjs', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, when I try to run the apps, I'm seeing
Uncaught ReferenceError: require is not defined
in the browser console for the Rollup apps, I think because the output format is CJS, which doesn't run natively in browsers. Am I missing something here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes - graphql-tag
causes some interesting bundling issues for sure. I'll fix this - thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@benjamn Digging into this, I'm not seeing the same thing; can you run a npm run build
on AC first, then try running the app again? Since the example app is referencing the compiled files in dist
, maybe they just need to be updated first.
This commit introduces a few different Apollo Client bundling example applications. These applications demonstrate how Apollo Client can be bundled using modern bundling tools like Rollup and webpack, along with features like tree shaking / dead code elimination. Each application can be run on its own, but the larger intent of these changes is to provide a way to gather metrics around production bundle sizes for applications using Apollo Client, with its dependencies. So instead of reporting on the bundle size for just `@apollo/client`, the provided `bundlesize.sh` script can be used to gather full Apollo Client based application bundle size metrics. These metrics should help give us a better understanding of Apollo related bundle sizes during real world production use.
550d9a5
to
236d9d8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, this is working for me now!
This PR introduces a few different Apollo Client bundling example applications. These applications demonstrate how Apollo Client can be bundled using modern bundling tools like Rollup and webpack, along with features like tree shaking / dead code elimination. Each application can be run on its own, but the larger intent of these changes is to provide a way to gather metrics around production bundle sizes for applications using Apollo Client, with its dependencies. So instead of reporting on the bundle size for just
@apollo/client
, the providedbundlesize.sh
script can be used to gather full Apollo Client based application bundle size metrics. These metrics should help give us a better understanding of Apollo related bundle sizes during real world production use.