Skip to content

Commit bfc10c3

Browse files
committed
feat: load environment variables in VitePress config
- Added `loadEnv` to import environment variables. - Exposed `VITE_REOWN_PROJECT_ID` to the client for better configuration management.
1 parent 9db41a7 commit bfc10c3

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

.vitepress/config.mts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
import { transformerTwoslash } from '@shikijs/vitepress-twoslash';
22
import tailwindcss from '@tailwindcss/vite';
3-
import { defineConfig } from 'vitepress';
3+
import { defineConfig, loadEnv } from 'vitepress';
44
import { fileURLToPath, URL } from 'node:url';
55
import { getSidebar } from './sidebar';
66
import {
77
groupIconMdPlugin,
88
groupIconVitePlugin,
99
} from 'vitepress-plugin-group-icons';
1010

11+
// Charger les variables d'environnement
12+
const env = loadEnv('', process.cwd());
13+
1114
// https://vitepress.dev/reference/site-config
1215
export default defineConfig({
1316
title: 'iExec documentation',
@@ -23,6 +26,10 @@ export default defineConfig({
2326
'@': fileURLToPath(new URL('../src', import.meta.url)),
2427
},
2528
},
29+
// Expose environment variables to the client
30+
define: {
31+
'import.meta.env.VITE_REOWN_PROJECT_ID': JSON.stringify(env.VITE_REOWN_PROJECT_ID),
32+
},
2633
},
2734
srcDir: './src',
2835
markdown: {

0 commit comments

Comments
 (0)