I have an app that does external calls via Angular and also uses native functionality via Cordova plugins - which means I have to test on devices (real and emulator) to see all functionality (and also not have the CORS issues of browsers).
The CLI has this nice
--livereload feature where it rebuilds the HTML/JS part of the app just like
ionic serve so I don’t have to build the app again with each change - which saves a lot of time of course.
And then I use https://ionic.zone/debug/remote-debug-your-app#android to inspect my app while it is running on the device, see the console logs in a bit prettier way than on the command line (via
Unfortunately when I combine the remote debugging with using livereload on the device, my external calls fail because of CORS issues:
Fetch API cannot load https://example.org/api. No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘http://192.168.10.1:8101’ is therefore not allowed access. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.
Does that mean that livereload + remote debugging breaks the advantages of debugging on the device in the first place? Is there a way I can live debug and still have my code work as it normally does on the device?
(Unfortunately the CORS stuff can’t be solved differently, and I fear there will be other things that don’t work as expected on livereload + remote debugging)