feat: 项目初始化及当前全部内容提交

This commit is contained in:
2025-07-15 17:37:50 +08:00
parent ec817067f1
commit e78f192d34
622 changed files with 75174 additions and 383 deletions
+61
View File
@@ -0,0 +1,61 @@
import { defineConfig, loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'
export default defineConfig(({ mode }) => {
// 加载环境变量
const env = loadEnv(mode, process.cwd(), '')
return {
plugins: [vue()],
base: mode === 'production' ? '/emotion-museum/' : '/',
resolve: {
alias: {
'@': resolve(__dirname, 'src')
}
},
server: {
port: 3000,
open: true,
proxy: {
// 所有API请求统一通过网关代理
'/api': {
target: env.VITE_API_TARGET || 'http://localhost:19000',
changeOrigin: true,
secure: false,
rewrite: (path) => path.replace(/^\/api/, '')
},
// 验证码服务通过网关代理
'/captcha': {
target: env.VITE_API_TARGET || 'http://localhost:19000',
changeOrigin: true,
secure: false
},
// OAuth服务通过网关代理
'/oauth': {
target: env.VITE_API_TARGET || 'http://localhost:19000',
changeOrigin: true,
secure: false
}
}
},
build: {
outDir: 'dist',
assetsDir: 'assets',
sourcemap: mode === 'development',
rollupOptions: {
output: {
chunkFileNames: 'assets/js/[name]-[hash].js',
entryFileNames: 'assets/js/[name]-[hash].js',
assetFileNames: 'assets/[ext]/[name]-[hash].[ext]'
}
}
},
define: {
// 将环境变量注入到应用中
__APP_ENV__: JSON.stringify(env.VITE_APP_ENV),
__API_BASE_URL__: JSON.stringify(env.VITE_API_BASE_URL),
__DEBUG_MODE__: JSON.stringify(env.VITE_DEBUG_MODE === 'true')
}
}
})