Lock: Import errors on Auth0 Lock 10.12

Created on 3 Mar 2017  路  8Comments  路  Source: auth0/lock

After upgrading auth0-lock to 10.12.0, I am seeing the following error when building my project using webpack (1.14.0):

ERROR in ./bundle.js from UglifyJs
SyntaxError: Unexpected token: name (Core) [./~/auth0-lock/lib/index.js:7,0]

Lock import code:

import Auth0Lock from 'auth0-lock'

Versions:

  • node version: 7.4.0
  • webpack: 1.14.0
  • OS: MacOS 10.12.3

My current workaround is to use 10.11

bug

Most helpful comment

Thanks, reproduced this in my end and working on a fix

All 8 comments

@swarajban can you provide a sample where we can try to see why it's breaking your config since we lack the information from your either your description or workaround?
We recently migrated to webpack 2 but that should not affect your build and the transpile task was not changed significantly to break it.

@swarajban I sort of reproduced it (got an error from the import instead of Core) but might be related, any more info is appreciated. Also using webpack 2 should also fix this.

@hzalaz I'm also getting an error from the import:

image

image

I'm simply importing the module in my own code:

import Auth0Lock from 'auth0-lock'

webpack: 1.13.1
node: 6.9.5
os: MacOS 10.12.2

Here is a link to a project that demonstrates the error: https://dl.dropboxusercontent.com/u/5826539/lock-error.zip

Steps

  • unzip file, and cd in
  • npm install
  • npm run build-prod

See error:

ERROR in build.js from UglifyJs
SyntaxError: Unexpected token: name (Core) [./~/auth0-lock/lib/index.js:7,0]

The project is based of the /examples/bundling/webpack project in this repo

I confirm this issue. The previous version of auth0-lock library was transpiled to use require and now it's using import.

Tagged code that demonstrates this issue: https://github.com/codefortulsa/courtbook/releases/tag/auth0-lock-issue-892

My build failing in Travis: https://travis-ci.org/codefortulsa/courtbook/builds/207242110

Thanks, reproduced this in my end and working on a fix

Should be fixed with latest release v10.12.1. Tried it with the webpack 1 example in the repo and it works

@hzalaz works great, thanks for the quick turnaround! Feel free to close

Was this page helpful?
0 / 5 - 0 ratings