diff --git a/client/vite.config.js b/client/vite.config.js index 8659719..10685cd 100644 --- a/client/vite.config.js +++ b/client/vite.config.js @@ -1,29 +1,33 @@ import { fileURLToPath, URL } from 'node:url'; -import { defineConfig } from 'vite'; +import { defineConfig, loadEnv } from 'vite'; import vue from '@vitejs/plugin-vue'; import vueDevTools from 'vite-plugin-vue-devtools'; -export default defineConfig({ - plugins: [ - vue(), - vueDevTools(), - ], - resolve: { - alias: { - '@': fileURLToPath(new URL('./src', import.meta.url)), - }, - }, - server: { - allowedHosts: [ - import.meta.env.VITE_HOST, +export default defineConfig(({ mode }) => { + const env = loadEnv(mode, process.cwd(), ''); + + return { + plugins: [ + vue(), + vueDevTools(), ], - host: true, - port: 5173, - strictPort: true, - hmr: { - host: import.meta.env.VITE_HOST, - protocol: 'wss', - clientPort: 443, + resolve: { + alias: { + '@': fileURLToPath(new URL('./src', import.meta.url)), + }, }, - }, + server: { + allowedHosts: [ + env.VITE_HOST, + ], + host: true, + port: 5173, + strictPort: true, + hmr: { + host: env.VITE_HOST, + protocol: 'wss', + clientPort: 443, + }, + }, + }; });