Skip to content

Commit 7fc7192

Browse files
update vite envs
1 parent d63deab commit 7fc7192

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
VITE_DEBUG_REQUESTS=false
22
VITE_DEBUG_AGGRID=false
3+
VITE_DEBUG_HOOK_RENDER=false
34

45
VITE_API_GATEWAY=/api/gateway
56
VITE_WS_GATEWAY=/ws/gateway

src/utils/hooks.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
export function useDebugRender(label: string) {
99
// uncomment when you want the output in the console
10-
/*if (import.meta.env.DEV) {
10+
if (import.meta.env.VITE_DEBUG_HOOK_RENDER) {
1111
label = `${label} render`;
1212
console.count?.(label);
1313
console.timeStamp?.(label);
14-
}*/
14+
}
1515
}

src/vite-env.d.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,24 @@
77

88
/// <reference types="vite-plugin-svgr/client" />
99
/// <reference types="vite/client" />
10+
11+
/* Don't know why but seem that TypeScript merge definitions of these two interfaces with existing ones.
12+
* https://vitejs.dev/guide/env-and-mode#intellisense-for-typescript
13+
*/
14+
import { UrlString } from '@gridsuite/commons-ui';
15+
16+
interface ImportMetaEnv {
17+
/* From @gridsuite/commons-ui */
18+
readonly VITE_API_GATEWAY: UrlString;
19+
readonly VITE_WS_GATEWAY: UrlString;
20+
// readonly VITE_DEBUG_REQUESTS?: boolean;
21+
22+
/* From this app */
23+
readonly VITE_DEBUG_REQUESTS: boolean;
24+
readonly VITE_DEBUG_AGGRID: boolean;
25+
readonly VITE_DEBUG_HOOK_RENDER: boolean;
26+
}
27+
28+
interface ImportMeta {
29+
readonly env: ImportMetaEnv;
30+
}

0 commit comments

Comments
 (0)