Skip to content

Commit

Permalink
Add graphql/execution/execute to external list in rollup.config.js.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
benjamn committed Jul 16, 2020
1 parent 218a2b4 commit 0d9250e
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions config/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,22 @@ import packageJson from '../package.json';
const distDir = './dist';

const external = [
'tslib',
'ts-invariant',
'symbol-observable',
'graphql/language/printer',
'optimism',
'graphql/language/visitor',
'graphql-tag',
'fast-json-stable-stringify',
'@wry/context',
'@wry/equality',
'fast-json-stable-stringify',
'graphql-tag',
'graphql/execution/execute',
'graphql/language/printer',
'graphql/language/visitor',
'hoist-non-react-statics',
'optimism',
'prop-types',
'react',
'subscriptions-transport-ws',
'symbol-observable',
'ts-invariant',
'tslib',
'zen-observable',
'prop-types',
'hoist-non-react-statics',
'subscriptions-transport-ws'
];

function prepareESM(input, outputDir) {
Expand Down

0 comments on commit 0d9250e

Please sign in to comment.