This is hacky. There are two options here:

1. Use a NodeJS version of XMLHttpRequest.
2. Inject a loader

The benefit of 1 is that it would actually allow the resource to be fetched over the network.