Skip to content

Unable to import auth0-lock/passwordless or 'TypeError: Super expression must either be null or a function, not undefined' #1257

@de-code

Description

@de-code

As was confirmed in #1256 - the import should be:

import Auth0LockPasswordless from 'auth0-lock/passwordless';

However, that would complain that it can't resolve auth0-lock/passwordless.

Thinking it might be my setup, I checked out your auth0-react-samples with the same effect - after ensuring that the module auth0-lock has the version 11.2.2 (which should have the passwordless support merged).

Looking at the module itself, there is however a lib folder so I was experimenting with that. You may stop me here as I shouldn't be doing that, but I am including it anyway.

I went ahead and changed the import:

import Auth0LockPasswordless from 'auth0-lock/lib/passwordless';

Now it can compile but fails at runtime trying to instantiate Auth0LockPasswordless:

Uncaught TypeError: Super expression must either be null or a function, not undefined
    at _inherits (bundle.js:82563)
    at bundle.js:82566
    at Object.<anonymous> (bundle.js:82578)
    at __webpack_require__ (bundle.js:556)
    at fn (bundle.js:87)
    at Object.<anonymous> (bundle.js:82289)
    at __webpack_require__ (bundle.js:556)
    at fn (bundle.js:87)
    at Object.<anonymous> (bundle.js:81380)
    at __webpack_require__ (bundle.js:556)

With the lines 82563 to 82566 being:

	function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

	var Auth0Lock = function (_Core) {
	  _inherits(Auth0Lock, _Core);

This seem to come down to it not finding the base class (here _Core).

Interestingly, importing the index (either just auth0-lock or auth0-lock/lib/index) seem to make the auth0-lock/lib/passwordless import work.

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