@dfinity/agent 0.9.3 not working with Angular default settings

Hi!
I’m trying to setup a simple call to https://identity.ic0.app.
Building the default plain vanilla Angular app with @dfinity/agent fails (app doesn’t compile successfully). App contents:
import {AuthClient} from ‘@dfinity/auth-client’;
async init() {

  • this.authClient = await AuthClient.create();*
    }

Compilation error is:
Error: Optimization error [main.js]: Error: Transform failed with 1 error:
main.js:93948:5: error: Expected identifier but found “=”
at failureErrorWithLog (…/node_modules/esbuild/lib/main.js:1449:15)
at …node_modules/esbuild/lib/main.js:1260:29
at …/node_modules/esbuild/lib/main.js:609:9
at handleIncomingPacket (…/node_modules/esbuild/lib/main.js:706:9)
at Socket.readFromStdout (…/node_modules/esbuild/lib/main.js:576:7)
at Socket.emit (events.js:315:20)
at addChunk (_stream_readable.js:295:12)
at readableAddChunk (_stream_readable.js:271:9)
at Socket.Readable.push (_stream_readable.js:212:10)
at Pipe.onStreamRead (internal/stream_base_commons.js:186:23)

I got past a bunch of errors related to BigInt, installing missing dependencies etc but got stuck on this.
Any ideas?? Thanks.

Never used the auth with Angular but, as I noticed esbuild in your stacktrace wanted to ask if you tried with Angular v12.1 and if you had the problem too?

I think they switched in v12.2 to esbuild for the CLI. Maybe it works with previous version?

Not a solution, just maybe a workaround.

1 Like

Good idea bro.
I downgraded to Angular 11.2 and that particular error went away. I ran into some new problems, but I’ve been able to resolve those.
Thanks!

2 Likes

Oh that’s good to know, cool!