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.

update to 5.0.3 -- `Right-hand side of 'instanceof' is not callable`

See original GitHub issue

hi there, the recent update from 5.0.2 to 5.0.3 broke the build on a project of mine.

here’s the error that we’re getting:

webpack-bundle-0674cf6….js:8 Uncaught TypeError: Right-hand side of 'instanceof' is not callable
    at o (webpack-bundle-0674cf6….js:8)
    at Object.run (webpack-bundle-0674cf6….js:8)
    at c.initSelector (webpack-bundle-0674cf6….js:8)
    at new c (webpack-bundle-0674cf6….js:8)
    at f._constructComponentWithoutOwner (webpack-bundle-0674cf6….js:7)
    at f._constructComponent (webpack-bundle-0674cf6….js:7)
    at f.mountComponent (webpack-bundle-0674cf6….js:7)
    at Object.mountComponent (webpack-bundle-0674cf6….js:5)
    at f.performInitialMount (webpack-bundle-0674cf6….js:7)
    at f.mountComponent (webpack-bundle-0674cf6….js:7)

apologies for the lack of detail, let me know if there’s anything i can do to clarify. thx!

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:4
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
dulecommented, Dec 5, 2017

We just ran into this error, which appears to be from a bad minification of redux. In our case, it was the result of uglifying already minified code.

This piece of code:

function makeSelectorStateful(sourceSelector, store) {
  // wrap the selector in an object that tracks its results between runs.
  const selector = {
    run: function runComponentSelector(props) {
      try {
        const nextProps = sourceSelector(store.getState(), props)
        if (nextProps !== selector.props || selector.error) {
          selector.shouldComponentUpdate = true
          selector.props = nextProps
          selector.error = null
        }
      } catch (error) {
        selector.shouldComponentUpdate = true
        selector.error = error
      }
    }
  }

minified to:

        function c(e, t) {
            var o = {
                run: function(n) {
                    try {
                        var r = e(t.getState(), n);
                        (r !== o.props || o.error) && (o.shouldComponentUpdate = !0,
                        o.props = r,
                        o.error = null)
                    } catch (s) {
                        o.shouldComponentUpdate = !0,
                        o.error = s
                    }
                }
            };
            return o
        }

and then on the second pass of uglifying became:

        function c(e, t) {
            var o = {
                run: function(e) {
                    try {
                        var n = r(t.getState(), e);
                        (n !== o.props || o.error) && (o.shouldComponentUpdate = !0,
                        o.props = n,
                        o.error = null)
                    } catch (r) {
                        o.shouldComponentUpdate = !0,
                        o.error = r
                    }
                }
            };
            return o
        }

r in var n = r(t.getState(), e);, which should have been the same variable as e in the top-level function now pointed to this function:

        function r(e, t) {
            if (!(e instanceof t))
                throw new TypeError("Cannot call a class as a function")
        }

which is this function:

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

I don’t understand how the minifier could mangle this so badly, but it caused a completely random call into _classCallCheck which is what was throwing our error. Removing the second uglify fixed our problem.

3reactions
data-dogecommented, Mar 12, 2017

@okmttdhr

ey, we just locked react-redux to 5.0.2 and moved on.

wish i could be more helpful!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Right-hand side of instanceof is not callable - Stack Overflow
instanceof is used to see if an object is an instance of a specific constructor (ex: banned instanceof Array ). If you just...
Read more >
TypeError: invalid 'instanceof' operand 'x' - JavaScript | MDN
The JavaScript exception "invalid 'instanceof' operand" occurs when the right-hand side operands of the instanceof operator isn't used with ...
Read more >
TinyMCE 5.9 | Docs
“Right-hand side of 'instanceof' is not callable” or “Event is not a function. (evaluating 'e instanceof Event')” exceptions.
Read more >
Right-hand side of 'instanceof' is not callable - Moralis Forum
I am getting a following error: TypeError: Right-hand side of 'instanceof' is not callable. My deps: "dependencies": { "moralis": "1.11.
Read more >
Error: Right-hand side of 'instanceof' is not callable | Vue Forums
We are glad to announce that our weekly patch release (19.4.47v) is rolled out. The “Compilation issue while using the Vue-class-component with Vue...
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