Host a mobile app on web

I have an Android application built with Ionic and Capacitor (v2). I’m trying to host the www folder on web instead of bundling it inside my APK by setting the server.url option in the Capacitor config. It works, except that it doesn’t use any native Android plug-ins. Instead, it falls back to a PWA implementation (window.Capacitor contains a CapacitorWeb instance). Moreover, my custom Capacitor plug-in for Android is trying to call window.Capacitor.triggerEvent, but it’s not defined in the web version of Capacitor.

How can I enable it to use Android plug-ins when running from a URL? Everything works when I use a npx ionic capacitor run android -l command (which hosts the web code from a local server), so it should be doable, but I must be missing something. I have several apps built on Cordova that work this way and I don’t want to keep my web code inside an APK or use Appflow with live updates just for that.