IE - graphql - SCRIPT5022:不能使用来自另一个模块或领域

时间:2018-05-19 04:41:50

标签: javascript reactjs internet-explorer webpack graphql

适用于除Internet Explorer之外的每个浏览器,其中发生以下错误。

  

SCRIPT5022:不能使用来自其他模块的未定义“布尔”或   领域。确保中只有一个“graphql”实例   node_modules目录。如果是“graphql”的不同版本   其他依赖于模块的依赖关系,使用“解决方案”来确保   只安装了一个版本。   https://yarnpkg.com/en/docs/selective-version-resolutions重复   “graphql”模块因不同而不能同时使用   版本可能具有不同的功能和行为。来自的数据   一个版本在另一个版本中使用的版本可能会产生混乱   和虚假的结果。

来自./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.");

2 个答案:

答案 0 :(得分:2)

您需要在IE11中添加 polyfill 以支持Download

答案 1 :(得分:1)

对于使用Babel转换应用程序的任何人,您都应该:

npm install --save babel-polyfill

然后导入您的index.js

import "babel-polyfill"

希望有帮助。