fix: 移除其他模板

This commit is contained in:
2026-07-08 15:56:59 +08:00
parent 2a1a049e9d
commit d5b32e3849
3 changed files with 66 additions and 11 deletions

42
lefthook.yml Normal file
View File

@@ -0,0 +1,42 @@
# EXAMPLE USAGE:
#
# Refer for explanation to following link:
# https://lefthook.dev/configuration/
#
# pre-push:
# jobs:
# - name: packages audit
# tags:
# - frontend
# - security
# run: yarn audit
#
# - name: gems audit
# tags:
# - backend
# - security
# run: bundle audit
#
# pre-commit:
# parallel: true
# jobs:
# - run: yarn eslint {staged_files}
# glob: "*.{js,ts,jsx,tsx}"
#
# - name: rubocop
# glob: "*.rb"
# exclude:
# - config/application.rb
# - config/routes.rb
# run: bundle exec rubocop --force-exclusion -- {all_files}
#
# - name: govet
# files: git ls-files -m
# glob: "*.go"
# run: go vet -- {files}
#
# - script: "hello.js"
# runner: node
#
# - script: "hello.go"
# runner: go run

View File

@@ -4,7 +4,7 @@ VITE_PORT=5999
VITE_BASE=/
# 请求路径
VITE_BASE_URL=http://127.0.0.1:48080
VITE_BASE_URL=http://192.168.10.14:48080
# 接口地址
VITE_GLOB_API_URL=/admin-api
# 文件上传类型server - 后端上传, client - 前端直连上传仅支持S3服务

View File

@@ -1,17 +1,30 @@
import { loadEnv } from 'vite';
import { defineConfig } from '@vben/vite-config';
export default defineConfig(async () => {
// @ts-ignore
export default defineConfig(async ({ mode }) => {
const env = loadEnv(mode, process.cwd(), 'VITE_');
const baseUrl = env.VITE_BASE_URL || 'http://localhost:48080';
const apiUrl = env.VITE_GLOB_API_URL || '/admin-api';
// 如果 apiUrl 已经是完整 URL如生产环境不需要 proxy
// 开发环境 apiUrl 为相对路径(如 /admin-api通过 proxy 转发
const isFullUrl = /^https?:\/\//.test(apiUrl);
return {
application: {},
vite: {
server: {
allowedHosts: true,
proxy: {
'/admin-api': {
proxy: isFullUrl
? {}
: {
[apiUrl]: {
changeOrigin: true,
rewrite: (path) => path.replace(/^\/admin-api/, ''),
// mock代理目标地址
target: 'http://localhost:48080/admin-api',
rewrite: (path) => path.replace(new RegExp(`^${apiUrl}`), ''),
// 代理目标地址,从环境变量 VITE_BASE_URL + VITE_GLOB_API_URL 拼接
target: `${baseUrl}${apiUrl}`,
ws: true,
},
},