-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathvite.config.ts
More file actions
28 lines (27 loc) · 735 Bytes
/
vite.config.ts
File metadata and controls
28 lines (27 loc) · 735 Bytes
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
import legacy from '@vitejs/plugin-legacy';
import reactRefresh from '@vitejs/plugin-react-refresh';
import { fileURLToPath } from 'url';
import { defineConfig } from 'vite';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [legacy(), reactRefresh()],
esbuild: {
jsxInject: `import React from 'react'`, // automatically import React in jsx files
},
resolve: {
alias: {
// for TypeScript path alias import like : @/x/y/z
'@': fileURLToPath(new URL('./src', import.meta.url)),
},
},
server: {
proxy: {
'/api': {
target: 'http://localhost:8080',
secure: false,
rewrite: path => path.replace(/^\/api/, ''),
},
},
open: true,
},
});