Skip to content

SourceLocation exported incorrect and breaks rollup in npm package #1210

Closed
@gaberudy

Description

@gaberudy

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions