How to manipulate files during build?

Hi there,
I’ve just made my first steps with Ionic 3 and it’s been great fun so far!
I’m using an ionic proxy-setting for local testing to work around the usual CORS issues when accessing remote APIs.

I’ve put all API URLs in a json file so I can switch between the proxied URLs like “/foo/bar” and the real ones like “https://somedomain.tld/foo/bar

When doing an on device-test or production build I would like to automatically switch to the real URLs during the build, But I currently have no idea how to accomplish this.

How would you go about replacing some files / file content during build?

I don’t know much about webpack, but I’m trying to learn a bit more. This might be what you’re looking for. But it might not.

I think this is doing something similar:

I checked it out and migrated it to Ionic 3 / Angular 4.