Graphql-js: SourceLocation exported incorrect and breaks rollup in npm package

Created on 26 Jan 2018  路  2Comments  路  Source: graphql/graphql-js

I use rollup with the commonjs plugin to pull in node_modules with tree-shaking.

I get the following error with graphql 0.12.3 (but do not with 0.11.3)
image

Error here for search indexing:

[!] Error: 'SourceLocation' is not exported by node_modules\graphql\module\language\index.js
https://github.com/rollup/rollup/wiki/Troubleshooting#name-is-not-exported-by-module
node_modules\graphql\module\index.js (64:17)
62:
63: // Parse and operate on GraphQL language source files.
64: export { Source, SourceLocation, getLocation,
                     ^
65: // Parse
66: parse, parseValue, parseType,

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

SourceLocation is a TypeScript type and is not defined (nor should be) in this JS module and thus can not be exported.

If I manually edit node_modules\graphql\module\index.js:64 to remove the SourceLocation from the export list, my rollup bundle completes.

I believe this is a recently introduced bug, and doesn't affect users who are not using this type of tree-shaking rollup usage since SourceLocation will be undefined and not used by anybody, but it would be nice to be able to update my config to 0.12.x

Most helpful comment

@leebyron would it be possible to cherry-pick this fix on the 0.12 branch?

All 2 comments

Thanks for the report

@leebyron would it be possible to cherry-pick this fix on the 0.12 branch?

Was this page helpful?
0 / 5 - 0 ratings