Skip to content

import GraphQLSomeObject from 'graphql' throws an error in node #2682

@lenneis

Description

@lenneis

Hi,

a simple import statement in node like

import { GraphQLObjectType } from 'graphql';

results in a syntax error:

SyntaxError: The requested module 'graphql' does not provide an export named 'GraphQLObjectType'

going to the right index.mjs file directly works:

import { GraphQLObjectType } from 'graphql/index.mjs';

This is in node 13.14, without using the esm module to run the code. It is probably because conditional exports for commonJS/ES6 modules are needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions