Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
de-code opened this issue Feb 8, 2018 · 1 comment · Fixed by #1259

Comments

@de-code
Copy link

de-code commented Feb 8, 2018

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.

@de-code de-code changed the title Unable to import auth0-lock/lib/passwordless or 'TypeError: Super expression must either be null or a function, not undefined' Unable to import auth0-lock/passwordless or 'TypeError: Super expression must either be null or a function, not undefined' Feb 8, 2018
@luisrudge
Copy link
Contributor

Hi @de-code. Thanks for bringing this up. I think we got the export totally wrong for Passwordless. I just opened a PR to fix this and do proper exports for it. In v.12.2.3 (soon to be released), you'll be able to import it like:

import { Auth0LockPasswordless } from 'auth0-lock'

Thanks again!

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

Successfully merging a pull request may close this issue.

2 participants