-
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
Add graphql/execution/execute to external list in rollup.config.js. #6624
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
benjamn
commented
Jul 16, 2020
'@wry/context', | ||
'@wry/equality', | ||
'fast-json-stable-stringify', | ||
'graphql-tag', | ||
'graphql/execution/execute', |
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 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.
benjamn
force-pushed
the
externalize-graphql/execution/execute
branch
from
July 16, 2020 23:17
b9097dd
to
7d15208
Compare
jcreighton
approved these changes
Jul 16, 2020
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
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.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This prevents the
@apollo/client/link/schema
CommonJS bundle (which is used by Node.js) from accidentally pulling in the entire dependency tree ofgraphql/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 causedinstanceof
to stop working reliably for types likeGraphQLSchema
, because there might be more than one definition of that constructor in play, andinstanceof
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.