Infer server port only in dev env
This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
export const defaultPromiseErrorHandler = (name: string) => (error: any) => {
|
export const defaultPromiseErrorHandler = (name: string) => (error: any) => {
|
||||||
if (process.env.NODE_ENV === 'production') {
|
if (import.meta.env.PROD) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ export abstract class BaseClient<Client, ClientConfig, Fetcher> {
|
|||||||
const { hostname, port, protocol } = window.location;
|
const { hostname, port, protocol } = window.location;
|
||||||
|
|
||||||
// if port is 3000 it's probably running from webpack development server
|
// if port is 3000 it's probably running from webpack development server
|
||||||
const inferredPort = port === '3000' ? '4567' : port;
|
const inferredPort = import.meta.env.DEV && port === '3000' ? '4567' : port;
|
||||||
return AppStorage.local.getItemParsed('serverBaseURL', `${protocol}//${hostname}:${inferredPort}`);
|
return AppStorage.local.getItemParsed('serverBaseURL', `${protocol}//${hostname}:${inferredPort}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user