-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
51 lines (48 loc) · 1.46 KB
/
vite.config.ts
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import { defineConfig, loadEnv } from 'vite';
import react from '@vitejs/plugin-react';
import { cwd } from 'process';
import path from 'path';
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, cwd(), ''); // Load .env variables
if (!env.VITE_JIRA_BASE_URL) {
//console.error('Error: VITE_JIRA_BASE_URL is not defined in .env');
//process.exit(1);
}
return {
define: {
__APP_ENV__: JSON.stringify(env.APP_ENV),
},
build: {
outDir: 'dist',
rollupOptions: {
input: {
main: path.resolve(__dirname, 'index.html')
}
}
},
plugins: [react()],
optimizeDeps: {
exclude: ['lucide-react'],
},
server: {
host: true,
port: 5173,
watch: {
usePolling: true,
},
proxy: {
'/api/jira': {
target: env.VITE_JIRA_BASE_URL,
secure: false,
changeOrigin: true,
headers: {
'X-Atlassian-Token': 'no-check',
origin: env.VITE_JIRA_BASE_URL,
'User-Agent': 'test',
},
rewrite: (path) => path.replace(/^\/api\/jira/, ''), // Corrected path rewrite syntax
},
},
},
};
});