5b5ab7e5
함상기
20240409
|
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
|
import { fileURLToPath, URL } from 'node:url';
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
// https://vitejs.dev/config/
export default defineConfig(() => {
return {
plugins: [vue()],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
},
},
server: {
proxy: {
'/api': { //#1. axios라이브러리 등으로 http 요청인데 api로 시작하면,
target: 'http://localhost:8080', //#2. 이쪽 주소로 매핑하여 백그라운드로 보내라.
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, '/api'),
secure: false,
ws: true
}
}
}
};
});
|