Syntax Error in Android Studio Emulator: SyntaxError: Unexpected token '{' (Angular)

I have created Angular app(v-18.0.6) with command “ng new myapp” which runs perfectly in my local environment. When I ran the app in emulator(pixel 7 API 30, pixel 7 API 30 and etc) of android studio by using capacitor I got the following error in the Chrome(chrome://inspect/#devices).

SyntaxError: Unexpected token ‘{’
polyfills-6UXIKGYX.js:1 Uncaught SyntaxError: Unexpected token ‘{’
SyntaxError: Unexpected token ‘=’
cap.handleError
main-AE5OQ3WL.js:1 Uncaught SyntaxError: Unexpected token ‘=’
favicon.ico:1 GET https://localhost/favicon.ico 404 (Not Found)

my operating system is windows 11. I have tried node versions of 18.20.4, 20.17, 21.7.3 and have updated the emulator to latest version but got the same error. The target of tsconfig.json is “target”: “ES2022”.

Used following commands to create angular app and add capacitor to my project

  1. ng new myapp
  2. npm i @capacitor/core
  3. npm i @capacitor/cli --save-dev
  4. npx cap init
  5. npm i @capacitor/android
  6. ng build
  7. changed “webDir” to “dist/myproject/browser” in capacitor.config.ts
  8. npx cap add android
  9. npx cap open android

see Problems with white screen after splash screen on android 7 and below \ Ionic 7 with Angular - #2 by julio-ionic

Thank you, it works perfectly.