diff --git a/.env b/.env index 60dec3d..1977a1e 100644 --- a/.env +++ b/.env @@ -1,3 +1,4 @@ # Glob API URL VITE_GLOB_API_URL=/api -VITE_APP_API_BASE_URL = http://localhost:3002/ + +VITE_APP_API_BASE_URL=http://localhost:3002/ diff --git a/src/typings/env.d.ts b/src/typings/env.d.ts index 9474435..ca60025 100644 --- a/src/typings/env.d.ts +++ b/src/typings/env.d.ts @@ -1,6 +1,6 @@ /// interface ImportMetaEnv { - /** api url */ readonly VITE_GLOB_API_URL: string; + readonly VITE_APP_API_BASE_URL: string; } diff --git a/vite.config.ts b/vite.config.ts index d1ad71b..81bf35b 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -3,7 +3,8 @@ import { defineConfig, loadEnv } from 'vite' import vue from '@vitejs/plugin-vue' export default defineConfig((env) => { - const viteEnv = loadEnv(env.mode, process.cwd()) + const viteEnv = loadEnv(env.mode, process.cwd()) as unknown as ImportMetaEnv + return { resolve: { alias: { @@ -14,7 +15,7 @@ export default defineConfig((env) => { server: { port: 1002, host: '0.0.0.0', - open: false, + open: true, proxy: { '/api': { target: viteEnv.VITE_APP_API_BASE_URL,