-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
52 lines (47 loc) · 1.61 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
import { defineConfig} from 'vite'
import { resolve } from 'path'
import react from '@vitejs/plugin-react'
import envCompatible from 'vite-plugin-env-compatible'
import viteTsconfigPaths from 'vite-tsconfig-paths'
import dns from 'dns'
dns.setDefaultResultOrder('verbatim')
export default defineConfig(({mode}) => {
// Load environment variables
return {
base: '/', // Add this line
define: {
'process.env.NODE_ENV': JSON.stringify(mode),
},
plugins: [react(), viteTsconfigPaths() , envCompatible()],
css: {
postcss: {
plugins: [require('tailwindcss'), require('autoprefixer')],
},
},
server: {
proxy: {
'/api': {
target: 'https://api.investipi.com/', // Set the target to yosur server
// target: 'https://localhost:5000/', // Set the target to yosur server
changeOrigin: true, // Change the origin to match the target
// rewrite: (path) => path.replace(/^\/api/, ''), // Optionally rewrite the path
},
},
// Add this line to handle client-side routing
open: true,
host: "localhost",
port: 8080
},
build: {
target : 'esnext',
lib: {
entry: resolve(__dirname, '/index.html'),
name: 'myLib',
fileName: 'myLib',
},
rollupOptions: {
external: [/^node:\w+/], // <-- ignores all 'node:*'
},
},
}
})