-
-
Notifications
You must be signed in to change notification settings - Fork 519
Open
Labels
axiosAxios related issueAxios related issuefetchFetch client related issueFetch client related issue
Description
Problem
An API may be present on several different servers. When building a JS bundle, you don't necessarily want to couple that bundle to a single API. However, that is the case with the baseURL, which doesn't have a way to be set at runtime, other than through using a transformer override.
Feature Request
I would like to be able to point the base URL to a runtime variable or a function that resolves it the same you do with custom fetch clients or JSON revivers. E.g.
{... baseUrl: { resolve: './baseUrlResolve.ts'} }
// baseUrlResolve.ts
function getBaseUrl() {
return window.apiBaseUrl;
}
export default getBaseUrlThe function would be called every time the base URL was to be resolved.
Alternatively a static variable could be referenced:
{... baseUrl: { variable: 'window.baseUrl'} }
Metadata
Metadata
Assignees
Labels
axiosAxios related issueAxios related issuefetchFetch client related issueFetch client related issue