fix(env-utils): connect build

This commit is contained in:
Jiri Zbytovsky
2025-11-20 10:24:29 +01:00
committed by Jiri Zbytovsky
parent 1b26dbdd04
commit 3cc73bd8a4

View File

@@ -3,14 +3,14 @@ const isWeb = () => process.env.SUITE_TYPE === 'web'; // duplicated with envUtil
// This needs to be set as `.` so it loads from appDir of the Electron app.
// For example (in case of AppImage): `file:///tmp/.mount_TrezorAvGo8g/resources/app.asar/build`,
// where the requested asset (for example: `static/images/images/app-store-badge.svg`) is located.
const DEFAULT_ASSET_PREFIX = isWeb() ? '' : '.';
const getDefaultAssetPrefix = () => (isWeb() ? '' : '.');
export const resolveStaticPath = (
path: string,
pathPrefix: string | undefined = process.env.ASSET_PREFIX,
) => `${pathPrefix || DEFAULT_ASSET_PREFIX}/static/${path.replace(/^\/+/, '')}`;
) => `${pathPrefix || getDefaultAssetPrefix()}/static/${path.replace(/^\/+/, '')}`;
export const resolveConnectPath = (
path: string,
pathPrefix: string | undefined = process.env.ASSET_PREFIX,
) => `${pathPrefix || DEFAULT_ASSET_PREFIX}/${path.replace(/^\/+/, '')}`;
) => `${pathPrefix || getDefaultAssetPrefix()}/${path.replace(/^\/+/, '')}`;