question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Getting realm related error in console if using webpack.UglifyJsPlugin

See original GitHub issue

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!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:16 (5 by maintainers)

github_iconTop GitHub Comments

14reactions
gferrericommented, May 11, 2018

I am using 0.13.2 and I still see this error.

11reactions
jazzdragoncommented, Feb 11, 2021

Please re-open. Working with graphql on the client (with an RN project managed by expo) we don’t have NODE_ENV set, naturally, and getting this error when building the project, which causes the whole thing to crash. I don’t know what the source of the issue this check is for, but isn’t there something else you can check for, instead of NODE_ENV?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Remove console.logs with Webpack & Uglify - Stack Overflow
My understanding is that I can use standalone Uglify lib to get all the options, but I don't know which one? The problem...
Read more >
webpack/webpack - lib/mappings.wasm - Gitter
Hi All, Material fonts are not loaded when used offline. I am trying to use material-design-icons npm package and use material-icons offline.
Read more >
UglifyjsWebpackPlugin | webpack
This plugin uses uglify-js to minify your JavaScript. Requirements. This module requires a minimum of Node v6.9.0 and Webpack v4.0.0. Getting Started.
Read more >
Web Development with Node and Express - Van Meegern
lackluster console support, consider using a Linux VM for development. If you find the. 10 | Chapter 2: Getting Started with Node ...
Read more >
Front-End Performance Checklist 2021 (PDF, Apple Pages ...
To get accurate results and goals though, make sure to first get a thorough picture of your users' experience by studying your analytics....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found