Using a service worker to update an hybrid mobile app like a PWA

Hi all,

I’m building a Ionic mobile app, which will be compiled as a native app on Android/iOS (so, not a PWA).

I was wondering if there is a way, using for example service workers, to also point to a remote source (which can be edited by the user) for the code (for example https://example.com/my-ionic-app, which will contain the “dist” folder contents) and use the service worker to fetch the updated code in order to upgrade the app without building and installing a new version?
I am not a service workers expert, the first obstacle that i can think of (maybe a blocking one) is that the local files are served with the localhost domain, and there is no way to specify another domain (much less a dynamic domain).

If this is impossible, what would be the correct approach? Using two webviews, one to show a minimal UI to insert the remote URL and then starting another webview to load a PWA from a remote URL?

Thanks in advance,
Dario