32 lines
821 B
JavaScript
32 lines
821 B
JavaScript
import { defineConfig, loadEnv } from 'vite'
|
|
import vue from '@vitejs/plugin-vue'
|
|
import tailwindcss from '@tailwindcss/vite'
|
|
|
|
/**
|
|
* 실행 환경에 맞는 Vite 개발 서버와 프록시 설정을 만든다.
|
|
*
|
|
* @param {{ mode: string }} configurationContext Vite 실행 모드
|
|
* @returns {import('vite').UserConfig} Vite 설정
|
|
*/
|
|
function createViteConfiguration({ mode }) {
|
|
const environment = loadEnv(mode, process.cwd(), '')
|
|
const socketServerPort =
|
|
process.env.SOCKET_SERVER_PORT ||
|
|
environment.SOCKET_SERVER_PORT ||
|
|
'31873'
|
|
|
|
return {
|
|
plugins: [vue(), tailwindcss()],
|
|
server: {
|
|
proxy: {
|
|
'/socket.io': {
|
|
target: `http://127.0.0.1:${socketServerPort}`,
|
|
ws: true,
|
|
},
|
|
},
|
|
},
|
|
}
|
|
}
|
|
|
|
export default defineConfig(createViteConfiguration)
|