fix: platform env var

NATIVE vs WEB
This commit is contained in:
didierfranc
2025-01-09 13:28:06 +01:00
parent 074a5181ba
commit f6c2924a00
4 changed files with 4 additions and 6 deletions

View File

@@ -23,4 +23,4 @@ export interface OLAPEngine {
getSchema(): Promise<Table[]>;
}
export const engine: OLAPEngine = FORCE_REMOTE_ENGINE ? new RemoteEngine() : new CHDBEngine();
export const engine: OLAPEngine = PLATFORM === 'WEB' ? new RemoteEngine() : new CHDBEngine();

View File

@@ -116,7 +116,7 @@
set_app_context({ context_menu });
let screen_width = $state(0);
let is_mobile = $derived(screen_width < 768 && WEB_APP);
let is_mobile = $derived(screen_width < 768 && PLATFORM === 'WEB');
let open_drawer = $state(false);
$effect(() => {

3
src/vite-env.d.ts vendored
View File

@@ -1,4 +1,3 @@
declare const FORCE_REMOTE_ENGINE: boolean;
declare const WEB_APP: boolean;
declare const PLATFORM: 'NATIVE' | 'WEB';
type MaybePromise<T> = T | Promise<T>;

View File

@@ -22,7 +22,6 @@ export default defineConfig(async () => ({
exclude: ['@sqlite.org/sqlite-wasm']
},
define: {
FORCE_REMOTE_ENGINE: process.env.FORCE_REMOTE_ENGINE === 'true',
WEB_APP: process.env.WEB_APP === 'true'
PLATFORM: JSON.stringify(process.env.PLATFORM || 'NATIVE')
}
}));