Cannot change server:androidScheme with Angular/Capacitor app

capacitor.config.json

"server": {
    "androidScheme": "file"
}

The Angular app never starts now, but without this change to the configuration everything was working.

This is the error in the console:

styles.4ebb591….css:1 Failed to load resource: net::ERR_FILE_NOT_FOUND
runtime-es2015.66c79b9….js:1 Failed to load resource: net::ERR_FILE_NOT_FOUND
polyfills-es2015.bb0…912616a6f89563.js:1 Failed to load resource: net::ERR_FILE_NOT_FOUND
main-es2015.c53c0c9….js:1 Failed to load resource: net::ERR_FILE_NOT_FOUND

The path to these files are displayed as:
file:///styles.4ebb591052f4ba9ed5c0.css
file:///runtime-es2015.66c79b9d36e7169e27b0.js
etc…

If I change the Angular base-href to “./” (ng build --prod --base-href=./) it seems like it can FIND the files now, but I now get CORS errors:

localhost/:1 Access to Script at 'file://localhost/runtime-es2015.66c79b9….js' from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.
localhost/:1 Access to Script at 'file://localhost/main-es2015.c53c0c9….js' from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.
localhost/:1 Access to Script at 'file://localhost/polyfills-es2015.bb0d229….js' from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.

Changing “androidScheme” works in a Vue app, but seemingly not Angular.

Don’t set the scheme to file, you should only set it to http or https, a custom scheme is also possible, but not recommended.

So apparently you can’t use “file” as the scheme with an Angular/Capacitor app, but other schemes seem to work OK.

I don’t know why it doesn’t work, but I feel like people would want to use “file” since Cordova used “file”.

If you used cordova-plugin-ionic-webview, which al ionic apps include when using cordova, it also uses http or https instead of file.
Using file has a lot of problems, that’s why the plugin was created and why capacitor doesn’t use it.