Skip to content

Getting realm related error in console if using webpack.UglifyJsPlugin #1182

@asci

Description

@asci

Hello,

I have a bit strange situation. If I build my project with UglifyJsPlugin I get this error:

Uncaught Error: Cannot use e "__Schema" 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.

I checked node_modules and I have only one graphql module installed and during development, I don't have this error. Moreover, my app still works fine and makes requests.

When I debug instanceOf I see something like this:

arguments[1].toString();
"function e(t){r(this,e),this.name=t.name,this.description=t.description,this.astNode=t.astNode,this._scalarConfig=t,"string"!=typeof t.name&&Object(Y.a)(0,"Must provide name."),"function"!=typeof t.serialize&&Object(Y.a)(0,this.name+' must provide "serialize" function. If this custom Scalar is also used as an input type, ensure "parseValue" and "parseLiteral" functions are also provided.'),(t.parseValue||t.parseLiteral)&&("function"!=typeof t.parseValue||"function"!=typeof t.parseLiteral)&&Object(Y.a)(0,this.name+' must provide both "parseValue" and "parseLiteral" functions.')}"
arguments[0].constructor.toString()
"function e(t){r(this,e),this.name=t.name,this.description=t.description,this.astNode=t.astNode,this.extensionASTNodes=t.extensionASTNodes,this.isTypeOf=t.isTypeOf,this._typeConfig=t,"string"!=typeof t.name&&Object(Y.a)(0,"Must provide name."),t.isTypeOf&&"function"!=typeof t.isTypeOf&&Object(Y.a)(0,this.name+' must provide "isTypeOf" as a function.')}"

Any ideas what it could be and how to avoid it?

Versions:

    "graphql": "^0.12.3",
    "webpack": "^3.8.1",
    "webpack-dev-server": "^2.9.4",

Thanks, and btw, Happy New Year!

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