Angular 8.2.5 and auth0-js 9.11.3 build error

Created a new Angular 8.2.5 app and am using auth0-js sdk for authentication. The build --prod fails with error main-es2015.0ca3931db620d1465b73.js: Unexpected reserved word ‘arguments’ (1:360758). I believe this is stemming from the auth0-js sdk as removing the auth0.WebAuth({}) object causes the prod build to succeed. I have heard of the new auth0-spa-js and the prod build succeeds using the create client method of the new sdk. Can someone confirm that Angular 8.2.5 doesn’t work with the auth0-js sdk or have a work around? Documentation appears to be sparse on the topic.

1 Like

Hey there!

Have you downloaded our Angular quickstart or you’re building your Angular app using our auth0-js SDK? Can you share more info on that front?

I’m building an Angular app and then adding in the auth0-js sdk.

Have you tried checking the repo readme if there isn’t any info on that? Let me know and I’ll start digging in

Okay! I was able to reproduce the issue from auth0’s github project! Clone this repo: GitHub - auth0-blog/angular-auth0-aside: Aside: Angular with Auth0 and an authenticated Node API.. Its currently on angular 8.0.0, add the auth0 env stuff to get it to build. Do a prod build and it will succeed. Now, do an “ng update @angular/cli @angular/core” to update to angular 8.2.7. Now do a prod build and you should get [error] SyntaxError: C:\Users\ianp\Desktop\ANgular8AuthTest\angular-auth0-aside\dist\main-es2015.db20bffe4d4071614ea5.js: Unexpected reserved word ‘arguments’ (1:203249). I just followed these steps and verified.

I think I am also getting this issue after upgrading from angular 8.0.2 to 8.2.x

Thank you everyone for providing that context! Passing this info right away to the tool maintainers!

I was asked if you can raise the issue in appropriate repo so as to communicate with the maintainers more effectively? Also sharing the link to the issue here will be super helpful for everyone looking for help in that field!

I created a new issue in the auth0-js github project. Here is the link: auth0-js 9.8+ not compatible with Angular 8.2.7 · Issue #1047 · auth0/auth0.js · GitHub.

Thanks a lot for sharing it with the rest of community!