2026-06-02 13:38:43 +08:00
|
|
|
|
import { fileURLToPath, URL } from 'node:url'
|
|
|
|
|
|
|
|
|
|
|
|
import { defineConfig } from 'vite'
|
|
|
|
|
|
import vue from '@vitejs/plugin-vue'
|
|
|
|
|
|
import vueJsx from '@vitejs/plugin-vue-jsx'
|
|
|
|
|
|
import vueDevTools from 'vite-plugin-vue-devtools'
|
2026-06-08 08:27:30 +08:00
|
|
|
|
import tailwindcss from '@tailwindcss/vite'
|
|
|
|
|
|
|
|
|
|
|
|
import AutoImport from 'unplugin-auto-import/vite'
|
|
|
|
|
|
import { NaiveUiResolver } from 'unplugin-vue-components/resolvers'
|
|
|
|
|
|
import Components from 'unplugin-vue-components/vite'
|
2026-06-02 13:38:43 +08:00
|
|
|
|
|
|
|
|
|
|
// https://vite.dev/config/
|
|
|
|
|
|
export default defineConfig({
|
|
|
|
|
|
plugins: [
|
|
|
|
|
|
vue(),
|
|
|
|
|
|
vueJsx(),
|
|
|
|
|
|
vueDevTools(),
|
2026-06-08 08:27:30 +08:00
|
|
|
|
tailwindcss(),
|
|
|
|
|
|
AutoImport({
|
|
|
|
|
|
imports: [{ 'native-ui': ['useDialog', 'useMessage', 'useNotification', 'useLoadingBar'] }]
|
|
|
|
|
|
}),
|
|
|
|
|
|
Components({
|
|
|
|
|
|
resolvers: [NaiveUiResolver()]
|
|
|
|
|
|
})
|
2026-06-02 13:38:43 +08:00
|
|
|
|
],
|
|
|
|
|
|
resolve: {
|
|
|
|
|
|
alias: {
|
|
|
|
|
|
'@': fileURLToPath(new URL('./src', import.meta.url))
|
|
|
|
|
|
}
|
2026-06-09 10:15:22 +08:00
|
|
|
|
},
|
|
|
|
|
|
server: {
|
|
|
|
|
|
proxy: {
|
|
|
|
|
|
'/api': {
|
|
|
|
|
|
/** 后端服务地址,按需修改 */
|
|
|
|
|
|
target: 'http://localhost:8080',
|
|
|
|
|
|
changeOrigin: true,
|
|
|
|
|
|
/** 去掉 /api 前缀转发给后端(如 /api/auth/login → /auth/login) */
|
|
|
|
|
|
rewrite: (path) => path.replace(/^\/api/, '')
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-06-02 13:38:43 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|