重写复现方法

This commit is contained in:
2025-09-01 18:18:44 +08:00
parent 7c11c1519b
commit 5d3d515b8e
41 changed files with 4249 additions and 5952 deletions

View File

@@ -1,7 +1,44 @@
import { defineConfig } from 'vite'
import { defineConfig, loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue'
import Icons from 'unplugin-icons/vite' // 图标插件
import IconsResolver from 'unplugin-icons/resolver' // 图标解析器
import Components from 'unplugin-vue-components/vite' // 组件自动导入
import { fileURLToPath, URL } from 'node:url'
import { resolve, dirname } from 'node:path'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()]
})
export default ({ mode }) => {
const env = loadEnv(mode, process.cwd())
const isProduction = mode === 'production'
return defineConfig({
base: isProduction ? '/cApi/' : '/',
plugins: [
vue(),
Components({
resolvers: [
// 自动解析图标组件前缀为Icon如<IconLogo />
IconsResolver({
prefix: 'Icon',
}),
],
}),
Icons({
autoInstall: true, // 自动安装图标依赖
}),
],
server: {
proxy: {
[env.VITE_BASE_API]: {
target: env.VITE_SERVER_URL,
changeOrigin: true,
}
}
},
resolve: {
alias: {
'@': resolve(dirname(fileURLToPath(import.meta.url)), 'src')
}
}
})
}