简体   繁体   中英

IE - graphql - SCRIPT5022: Cannot use undefined “Boolean” from another module or realm

works on every browser except Internet Explorer where the following error occurs.

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.

from ./node_modules/graphql/module/jsutils/instanceOf.js

 if (value) {
    var valueConstructor = value.constructor;
    if (valueConstructor && valueConstructor.name === constructor.name) {
      throw new Error("Cannot use " + constructor.name + " \"" + value + "\" 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.\n\nhttps://yarnpkg.com/en/docs/selective-version-resolutions\n\nDuplicate \"graphql\" modules cannot be used at the same time since different\nversions may have different capabilities and behavior. The data from one\nversion used in the function from another could produce confusing and\nspurious results.");

您需要添加一个polyfill以支持IE11中的Function.name

For anyone transpling an application with Babel, you should:

npm install --save babel-polyfill

And then import in your index.js

import "babel-polyfill"

Hope it helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM