It's seemingly obvious and took me all of about half a second to realise, but rather than showing the following message:
FetchError: invalid json response body at http://localhost:4001/v2/teal/compile?sourcemap=true reason: Unexpected token '/', "/teal/comp"... is not valid JSON
could the status code of 404 be checked first, and then have the full response be shown instead?
/teal/compile was not enabled in the configuration file by setting the EnableDeveloperAPI to true