Failing to run on webview with Chromium version 74 due to optional chaining

Hello,

I’m attempting to run an Ionic 6, Capacitor 3 project on an Android emulator that has Android 10 (Q), API level 29 and a webview with Chromium version 74.

The app builds and deploys but then fails immediately on loading. The problem is the optional chaining syntax (?.) in that ends up in the build of vendor.js.

Here’s an example:

  historyGo(relativePosition = 0) {
    this._platformLocation.historyGo?.(relativePosition);
  }

My emulator webview Chromium version is 74, which does not support optional chaining. Support was added at version 80.

It’s strange though because the Ionic/Capacitor docs say that Chromium version 60+ is supported.

So, does anyone know if I’ve got something set up wrong? Or is this a bug? And/or is there a way to get webpack to transpile optional chaining into more vanilla JS?

Thanks

where does that historyGo code comes from?
I did a search and it looks like it comes from angular.

Angular only supports latest 2 android versions by default, you can make it compile to es5 following this steps

Thank you for your response.

That’s exactly it, thank you! :pray: