diff --git a/packages/env-utils/src/resolveStaticPath.ts b/packages/env-utils/src/resolveStaticPath.ts index 31fe9c7f91..f54a9272e6 100644 --- a/packages/env-utils/src/resolveStaticPath.ts +++ b/packages/env-utils/src/resolveStaticPath.ts @@ -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(/^\/+/, '')}`;