Support VITE_CACHE_DIR environment variable for custom cache directory

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-06 19:40:18 +08:00
parent 7fec6cb63f
commit 9c6a51029b

View File

@@ -15,9 +15,10 @@ import { defineConfig, loadEnv } from "vite";
import vue from "@vitejs/plugin-vue"; import vue from "@vitejs/plugin-vue";
export default defineConfig(({ mode }) => { export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd()).VUE_APP_API_URL; const env = loadEnv(mode, process.cwd());
return{ return{
cacheDir: env.VITE_CACHE_DIR || undefined,
plugins: [vue()], plugins: [vue()],
base: '/', base: '/',
resolve: { resolve: {
@@ -32,7 +33,7 @@ export default defineConfig(({ mode }) => {
port: 58249, port: 58249,
proxy: { proxy: {
'/api': { '/api': {
target: env, target: env.VUE_APP_API_URL,
changeOrigin: true, changeOrigin: true,
rewrite: path => path.replace(/^\/api/, ''), rewrite: path => path.replace(/^\/api/, ''),
} }