Skip to content
This repository was archived by the owner on Apr 20, 2018. It is now read-only.

An error when global this is undefined #850

Closed
gchudnov opened this issue Aug 7, 2015 · 2 comments
Closed

An error when global this is undefined #850

gchudnov opened this issue Aug 7, 2015 · 2 comments

Comments

@gchudnov
Copy link

gchudnov commented Aug 7, 2015

Noticed this issue when using Rx with Babel + Browserify and imporing Rx: import Rx from 'rx'.

The problem is here:

/src/core/internal/util.js:

  var inherits = this.inherits = Rx.internals.inherits = function (child, parent) {
    function __() { this.constructor = child; }
    __.prototype = parent.prototype;
    child.prototype = new __();
  };

this.inherits
^^
this might be undefined. It is set-up in /src/core/headers/outro.js as:

}.call(this));

And top-level this is remapped to undefined in Babel.

I fixed it locally by replacing }.call(this)); with }.call(this || {}));

And now I'm wondering if it is necessary to add inherits to the global this, polluting it?

@mattpodwysocki
Copy link
Member

Fixed as per commit and v3.0.1

@gchudnov
Copy link
Author

Thank you!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants