Closed progotta closed 6 years ago
Can you try the following one to see if it works:
Every version of Webpack has a built-in version of UglifyJS (0.4.6) which doesn't support ES6. This version supports ES5 syntax only.
There are two possible solutions:
Make transpiler target es5 Don't use the built-in version of uglifyjs-webpack-plugin and install the latest version using npm install -D uglifyjs-webpack-plugin. Add it to your plugins property in your configuration: const UglifyJSPlugin = require('uglifyjs-webpack-plugin')
module.exports = { plugins: [ new UglifyJSPlugin() ] }
A similar issue can be found here: https://stackoverflow.com/questions/45870467/error-in-bundle-js-from-uglifyjs-name-expected/45952258
Hi @progotta, did you get it work? I think if you directly download the SDK from github repo or install it from npm, you need to ensure that you install node.js and npm correctly under the SDK directory.
cd /amazon-cognito-auth-js brew install node (more info: http://blog.teamtreehouse.com/install-node-js-npm-mac) npm install npm install -g node-modules
Then you can: npm run clean npm run build
This issue has been resolved. The primary issue was the inability to install from the NPM Registry - all of the other issues were related to having to build which is not necessary after being able to install directly through npm - have not tested the proposed solutions as I now am able to install directly.
The library is not in the NPM Registry, as indicated in the documentation, so installing from github, with the command:
npm install --save https://github.com/aws/amazon-cognito-auth-js.git
package.json shows as a dependency: "amazon-cognito-auth-js": "git+https://github.com/aws/amazon-cognito-auth-js.git"
If you reference the library in application, as the documentation outlines:
import {CognitoAuth} from 'amazon-cognito-auth-js';
Module not found: Error: Cannot resolve module 'amazon-cognito-auth-js'
This appears to be because there is no /lib directory, so, let't do a build...
ERROR in amazon-cognito-auth.min.js from UglifyJs SyntaxError: Unexpected token: name (CognitoIdentityServiceProvider) [./enhance.js:18,0]