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 graphql/execution/execute to external list in rollup.config.js. #6624

Merged
merged 2 commits into from
Jul 16, 2020

Conversation

benjamn
Copy link
Member

@benjamn benjamn commented Jul 16, 2020

This prevents the @apollo/client/link/schema CommonJS bundle (which is used by Node.js) from accidentally pulling in the entire dependency tree of graphql/execution/execute.

This duplication not only increased the @apollo/client/link/schema CJS bundle size from 1.31kB to a whopping 22.6kB, but also caused instanceof to stop working reliably for types like GraphQLSchema, because there might be more than one definition of that constructor in play, and instanceof is sensitive to the exact constructor function you pass as the right-hand argument.

Should fix #6621, allowing us to revert #6622. Thanks to @stolinski (#6621) and @macrozone (#6614) for surfacing this issue.

'@wry/context',
'@wry/equality',
'fast-json-stable-stringify',
'graphql-tag',
'graphql/execution/execute',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also sorted this list, but this is the only new line.

This prevents the @apollo/client/link/schema CommonJS bundle (which is
used by Node.js) from accidentally pulling in the entire dependency tree
of graphql/execution/execute.

This duplication not only increased the @apollo/client/link/schema CJS
bundle size from 1.31kB to a whopping 22.6kB, but also caused instanceof
to stop working reliably for types like GraphQLSchema, because there might
be more than one definition of that constructor in play, and instanceof is
sensitive to the exact constructor function you pass as the right-hand
argument.

Should fix #6621, allowing us to revert #6622. Thanks to @stolinski for
surfacing this issue.
This reverts commit 218a2b4,
now that #6621 has been fixed by #6624.
@benjamn benjamn force-pushed the externalize-graphql/execution/execute branch from b9097dd to 7d15208 Compare July 16, 2020 23:17
Copy link
Contributor

@jcreighton jcreighton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@benjamn benjamn merged commit 123639c into master Jul 16, 2020
@benjamn benjamn deleted the externalize-graphql/execution/execute branch July 16, 2020 23:23
benjamn added a commit that referenced this pull request Jul 24, 2020
We don't currently have any external packages that we want to bundle into
@apollo/client, so we can get away with considering any non-relative
import to be external. The results of this test exactly match the current
contents of externalPackages, so it should be safe to remove that Set.

This should save us from making mistakes like the one I fixed in #6624,
and if we ever do want to bundle something from node_modules into the
@apollo/client bundle again, we can easily carve out an exception.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

error ApolloError: Expected (a schema) to be a GraphQL schema
2 participants