-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathvite.renderer.config.ts
More file actions
36 lines (34 loc) · 1.24 KB
/
vite.renderer.config.ts
File metadata and controls
36 lines (34 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import tailwindcss from '@tailwindcss/vite';
import path from 'node:path';
// Load .env file at build time (for npm run make)
// In development, variables may be pre-set by shell which take precedence
// In CI/CD, GitHub Actions/GitLab CI exports variables which take precedence
// Safe import: only load dotenv if available (may not be in CI)
try {
const dotenv = await import('dotenv');
dotenv.config();
} catch {
// dotenv not available (CI environment) - environment variables already set
console.log('dotenv not available, using existing environment variables');
}
// https://vitejs.dev/config
export default defineConfig({
plugins: [
react(),
tailwindcss(),
],
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
define: {
// Inject analytics environment variables at build time
// These will be replaced with literal values in the bundled code
'__GOOGLE_ANALYTICS_ID__': JSON.stringify(process.env.GOOGLE_ANALYTICS_ID || ''),
'__GOOGLE_ANALYTICS_API_SECRET__': JSON.stringify(process.env.GOOGLE_ANALYTICS_API_SECRET || ''),
'__APP_VERSION__': JSON.stringify(process.env.npm_package_version || ''),
},
});