admin08077 commited on
Commit
f306e63
·
verified ·
1 Parent(s): c989891

Update vite.config.ts

Browse files
Files changed (1) hide show
  1. vite.config.ts +13 -4
vite.config.ts CHANGED
@@ -3,25 +3,34 @@ import { fileURLToPath } from 'url';
3
  import { defineConfig, loadEnv } from 'vite';
4
  import react from '@vitejs/plugin-react';
5
 
6
- // Fix: __dirname is not available in ES modules environment.
7
- // We define it using path.dirname and fileURLToPath(import.meta.url).
8
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
9
 
10
  export default defineConfig(({ mode }) => {
11
  const env = loadEnv(mode, '.', '');
 
12
  return {
13
  server: {
14
  port: 3000,
15
  host: '0.0.0.0',
16
  },
 
 
 
 
 
 
 
 
 
17
  plugins: [react()],
 
18
  define: {
19
  'process.env.API_KEY': JSON.stringify(env.GEMINI_API_KEY),
20
- 'process.env.GEMINI_API_KEY': JSON.stringify(env.GEMINI_API_KEY)
21
  },
 
22
  resolve: {
23
  alias: {
24
- // Fix: Use the polyfilled __dirname variable to resolve project root
25
  '@': path.resolve(__dirname, '.'),
26
  }
27
  }
 
3
  import { defineConfig, loadEnv } from 'vite';
4
  import react from '@vitejs/plugin-react';
5
 
 
 
6
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
7
 
8
  export default defineConfig(({ mode }) => {
9
  const env = loadEnv(mode, '.', '');
10
+
11
  return {
12
  server: {
13
  port: 3000,
14
  host: '0.0.0.0',
15
  },
16
+
17
+ preview: {
18
+ host: '0.0.0.0',
19
+ port: 3000,
20
+ allowedHosts: [
21
+ 'admin08077-aibanking-dev.hf.space'
22
+ ]
23
+ },
24
+
25
  plugins: [react()],
26
+
27
  define: {
28
  'process.env.API_KEY': JSON.stringify(env.GEMINI_API_KEY),
29
+ 'process.env.GEMINI_API_KEY': JSON.stringify(env.GEMINI_API_KEY),
30
  },
31
+
32
  resolve: {
33
  alias: {
 
34
  '@': path.resolve(__dirname, '.'),
35
  }
36
  }