Auth0 Home Blog Docs

Getting an error "Unexpected Identifier" from auth0-js plugin (Cordova)


#1

After an update to my npm packages (I am using auth-lock) the dependency of auth0-js changes from version 8.11.2 to 9.7.3

This started breaking my app with a js error “Uncaught SyntaxError: Unexpected identifier” that points to the first import line below “import version from ‘…/…/src/version’;”

/* 607 /
/
!!
!
./~/auth0-lock/~/auth0-js/plugins/cordova/index.js ***!
*
***/
/***/ (function(module, exports) {

import version from '../../src/version';
import windowHandler from '../../src/helper/window';
import PluginHandler from './plugin-handler';

function CordovaPlugin() {

This can be seen happening at:
http://gettrip.guru/

Attached a screenshot of the console

2018-07-24_1530

I know this is causing the problem since downgrading to to 8.11.2 loads the app just fine.

Here is the package.json file:
{
“name”: “trippere”,
“version”: “0.1.0”,
“private”: true,
“dependencies”: {
“apollo-cache-inmemory”: “^1.1.0”,
“apollo-client”: “^2.0.2”,
“apollo-link-context”: “^1.0.0”,
“apollo-link-http”: “^1.1.0”,
“apollo-upload-client”: “^5.1.1”,
“auth0-lock”: “^11.7.2”,
“autoprefixer”: “6.7.2”,
“axios”: “^0.17.1”,
“babel-jest”: “18.0.0”,
“babel-plugin-transform-decorators-legacy”: “^1.3.4”,
“babel-preset-env”: “^1.6.1”,
“babel-preset-react-app”: “^2.2.0”,
“bootstrap”: “^3.3.7”,
“braintree-web-drop-in”: “^1.10.0”,
“case-sensitive-paths-webpack-plugin”: “1.1.4”,
“chalk”: “1.1.3”,
“classnames”: “^2.2.5”,
“connect-history-api-fallback”: “1.3.0”,
“css-loader”: “0.26.1”,
“currency-symbol-map”: “^4.0.3”,
“detect-port”: “1.1.0”,
“dompurify”: “^1.0.3”,
“dotenv”: “2.0.0”,
“emojione-picker”: “^2.2.1”,
“eslint”: “3.16.1”,
“eslint-config-react-app”: “^0.6.2”,
“eslint-loader”: “1.6.0”,
“eslint-plugin-flowtype”: “2.21.0”,
“eslint-plugin-import”: “2.0.1”,
“eslint-plugin-jsx-a11y”: “4.0.0”,
“eslint-plugin-react”: “^7.3.0”,
“extract-text-webpack-plugin”: “1.0.1”,
“file-loader”: “0.10.0”,
“fs-extra”: “0.30.0”,
“graphql”: “^0.11.7”,
“graphql-tag”: “^2.5.0”,
“html-webpack-plugin”: “2.24.0”,
“http-proxy-middleware”: “0.17.3”,
“i18next”: “^9.0.0”,
“i18next-browser-languagedetector”: “^2.0.0”,
“jquery”: “^3.2.1”,
“json-loader”: “0.5.4”,
“langs”: “^2.0.0”,
“lodash”: “^4.17.4”,
“material-ui”: “^0.19.4”,
“mobx”: “^4.1.0”,
“mobx-react”: “^5.0.0”,
“mobx-stored”: “^1.0.2”,
“moment”: “^2.18.1”,
“moment-range”: “^3.0.3”,
“moment-recur”: “^1.0.7”,
“moment-timezone”: “^0.5.13”,
“node-sass-chokidar”: “0.0.3”,
“npm-run-all”: “^4.0.2”,
“postcss-loader”: “1.2.2”,
“prop-types”: “^15.5.10”,
“protractor”: “^5.2.0”,
“ramda”: “^0.25.0”,
“rc-time-picker”: “^2.4.1”,
“react”: “^15.6.1”,
“react-apollo”: “^1.4.10”,
“react-beautiful-dnd”: “^2.6.4”,
“react-bootstrap”: “^0.32.1”,
“react-bootstrap-autosuggest”: “^0.5.0”,
“react-bootstrap-modal”: “^3.0.1”,
“react-bootstrap-slider”: “^2.0.1”,
“react-bootstrap-tabs”: “^1.0.0”,
“react-bootstrap-typeahead”: “^2.6.0”,
“react-click-outside”: “^3.0.0”,
“react-contenteditable”: “^2.0.5”,
“react-date-range”: “^0.9.4”,
“react-datepicker”: “^0.53.0”,
“react-dates”: “^15.1.0”,
“react-dev-utils”: “^0.5.2”,
“react-dnd”: “^2.5.4”,
“react-dnd-html5-backend”: “^2.5.4”,
“react-dom”: “^15.6.1”,
“react-dropzone”: “^4.1.2”,
“react-facebook”: “^4.2.1”,
“react-fontawesome”: “^1.6.1”,
“react-foursquare”: “git+https://github.com/foursquare/react-foursquare.git”,
“react-geosuggest”: “^2.4.0”,
“react-google-autocomplete”: “^1.0.15”,
“react-google-maps”: “^7.3.0”,
“react-html-converter”: “^0.1.1”,
“react-i18next”: “^5.2.0”,
“react-infinite-scroller”: “^1.1.2”,
“react-input-mask”: “^1.0.7”,
“react-intl”: “^2.4.0”,
“react-linkify”: “^0.2.2”,
“react-notifications”: “^1.4.3”,
“react-places-autocomplete”: “^5.4.3”,
“react-quill”: “^1.2.2”,
“react-responsive-carousel”: “^3.1.33”,
“react-router-dom”: “^4.1.2”,
“react-scroll”: “^1.5.4”,
“react-select”: “^1.0.0-rc.10”,
“react-share”: “^2.0.0”,
“react-slick”: “^0.15.4”,
“react-star-rating-component”: “^1.3.0”,
“react-stars”: “^2.2.5”,
“react-stepzilla”: “^4.6.3”,
“react-virtualized”: “^9.18.5”,
“slick-carousel”: “^1.8.1”,
“style-loader”: “0.13.1”,
“styled-components”: “^2.0.0”,
“subscriptions-transport-ws”: “^0.8.3”,
“translate”: “^1.0.2”,
“underscore”: “^1.8.3”,
“unsplash-js”: “^4.8.0”,
“unsplash-source-js”: “^1.0.0”,
“url-loader”: “0.5.7”,
“validator”: “^8.2.0”,
“webpack”: “^1.15.0”,
“webpack-dev-server”: “1.16.2”,
“webpack-manifest-plugin”: “1.1.0”
},
“scripts”: {
“build-css”: “node-sass-chokidar --include-path ./src --include-path ./node_modules src/ -o src/”,
“watch-css”: “npm run build-css && node-sass-chokidar --include-path ./src --include-path ./node_modules src/ -o src/ --watch --recursive”,
“start-js”: “node --optimize_for_size --max_old_space_size=420 scripts/start.js”,
“start”: “npm-run-all -p watch-css start-js”,
“build”: “npm run build-css && node scripts/build.js”,
“test”: “node scripts/test.js --env=jsdom”
},
“devDependencies”: {
“autoprefixer”: “6.7.2”,
“babel-core”: “6.26.3”,
“babel-eslint”: “^7.2.3”,
“babel-jest”: “18.0.0”,
“babel-loader”: “^6.2.10”,
“babel-plugin-transform-decorators-legacy”: “^1.3.4”,
“babel-preset-env”: “^1.6.1”,
“babel-preset-react-app”: “^2.2.0”,
“babel-runtime”: “^6.26.0”,
“chalk”: “1.1.3”,
“connect-history-api-fallback”: “1.3.0”,
“detect-port”: “1.1.0”,
“eslint”: “3.16.1”,
“eslint-config-react-app”: “^0.6.2”,
“eslint-loader”: “1.6.0”,
“eslint-plugin-flowtype”: “2.21.0”,
“eslint-plugin-import”: “2.0.1”,
“eslint-plugin-jsx-a11y”: “4.0.0”,
“eslint-plugin-react”: “^7.3.0”,
“file-loader”: “0.10.0”,
“react-dev-utils”: “^0.5.2”,
“react-social-icons”: “^2.8.1”
},
“babel”: {
“presets”: [
“react-app”
]
},
“eslintConfig”: {
“extends”: “react-app”
},
“engines”: {
“node”: “8.11.3”
}
}