feat: 添加 ts 类型
This commit is contained in:
parent
7835740159
commit
7930ec5dab
3
.env
3
.env
|
@ -1,3 +1,4 @@
|
||||||
# Glob API URL
|
# Glob API URL
|
||||||
VITE_GLOB_API_URL=/api
|
VITE_GLOB_API_URL=/api
|
||||||
VITE_APP_API_BASE_URL = http://localhost:3002/
|
|
||||||
|
VITE_APP_API_BASE_URL=http://localhost:3002/
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/// <reference types="vite/client" />
|
/// <reference types="vite/client" />
|
||||||
|
|
||||||
interface ImportMetaEnv {
|
interface ImportMetaEnv {
|
||||||
/** api url */
|
|
||||||
readonly VITE_GLOB_API_URL: string;
|
readonly VITE_GLOB_API_URL: string;
|
||||||
|
readonly VITE_APP_API_BASE_URL: string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,8 @@ import { defineConfig, loadEnv } from 'vite'
|
||||||
import vue from '@vitejs/plugin-vue'
|
import vue from '@vitejs/plugin-vue'
|
||||||
|
|
||||||
export default defineConfig((env) => {
|
export default defineConfig((env) => {
|
||||||
const viteEnv = loadEnv(env.mode, process.cwd())
|
const viteEnv = loadEnv(env.mode, process.cwd()) as unknown as ImportMetaEnv
|
||||||
|
|
||||||
return {
|
return {
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
|
@ -14,7 +15,7 @@ export default defineConfig((env) => {
|
||||||
server: {
|
server: {
|
||||||
port: 1002,
|
port: 1002,
|
||||||
host: '0.0.0.0',
|
host: '0.0.0.0',
|
||||||
open: false,
|
open: true,
|
||||||
proxy: {
|
proxy: {
|
||||||
'/api': {
|
'/api': {
|
||||||
target: viteEnv.VITE_APP_API_BASE_URL,
|
target: viteEnv.VITE_APP_API_BASE_URL,
|
||||||
|
|
Loading…
Reference in New Issue