Cannot open webapp as local files in browser

I have a webapp that I originally built using Ionic 2 in 2017, and host on a website, but also bundled as a desktop app, (like cordova, but not using cordova) with local files opened in an app with a browser window which opened the local files.

I wanted to update the app, and found that with all of the changes since 2017 it would not build. I bit the bullet and have upgraded everything to the current ionic (6.18.1) and angular (13.2.6), and it works properly using ionic serve.

The problem is that does not work when opened directly in a browser, or the mini-browser in my wrapper. The problem is that there is a CORS error. The browser thinks this is a violation of security protocols. This does not happen with the Ionic 2 webapp, The error is reproduced if I create a new minimal tabs app with the current Ionic build, as well.

To be clear:

Ionic 2 webapp → Open file index.html locally in browser → Works
Ionic 6 webapp → Open file index.html locally in browser → CORS error

This is the same with Chrome, Safari, Brave and Firefox.

Any suggestions for a workaround? I have tried unsuccessfully to downgrade to Ionic 2. A challenge is that my laptop is now Apple silicon (M1), although I do have a desktop machine that is Intel, if I knew what configuration to recreate.

I think the most direct would be to recreate the ionic 2 setup, but it would be better to have a solution with the current tools.

Thanks for any suggestions.

Have you tried running in using the ionic serve command?

Yes. That works fine. That creates a node.js server. I was trying to access the web assets directly as a file from the browser, which used to work perfectly, but no longer does. I wanted to create a wrapper desktop application which would use the code within a minimal browser which only could access the local files. This works with webapps made with Ionic 2, but not currently. The problem is that if you access the files directly it now creates a security violation in the browser. Accessing older files does not.

Ah, okay. Check this out, it can likely help you solve the issue.