Skip to content

Misleading error in Internet Explorer 11 #1356

Closed
@brunoabreu

Description

@brunoabreu

It throws the following error:

SCRIPT5022: Cannot use undefined "Boolean" from another module or realm. Ensure that there is only one instance of "graphql" in the node_modules directory. If different versions of "graphql" are the dependencies of other relied on modules, use "resolutions" to ensure only one version is installed. https://yarnpkg.com/en/docs/selective-version-resolutions Duplicate "graphql" modules cannot be used at the same time since different versions may have different capabilities and behavior. The data from one version used in the function from another could produce confusing and spurious results.

Turns out this happens because this code compares two function names:

const className = constructor.name;
if (valueClass && valueClass.name === className) {
throw new Error(
`Cannot use ${className} "${value}" from another module or realm.

Internet Explorer does not have support to Function.name. Thus the comparison will be undefined === undefined.

In my case, I fixed that by adding a polyfill. But I think this behavior is, at least, very confusing.

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