2025-06-14 15:12:49 +00: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'
|
|
|
|
|
import AutoImport from 'unplugin-auto-import/vite'
|
|
|
|
|
import Components from 'unplugin-vue-components/vite'
|
2025-06-15 12:38:03 +00:00
|
|
|
import { AntDesignVueResolver } from 'unplugin-vue-components/resolvers'
|
2025-06-14 15:12:49 +00:00
|
|
|
|
|
|
|
|
// https://vite.dev/config/
|
|
|
|
|
export default defineConfig({
|
|
|
|
|
plugins: [
|
|
|
|
|
vue(),
|
|
|
|
|
vueJsx(),
|
|
|
|
|
vueDevTools(),
|
|
|
|
|
AutoImport({
|
|
|
|
|
imports: [
|
|
|
|
|
'vue',
|
|
|
|
|
'vue-router',
|
|
|
|
|
'pinia',
|
|
|
|
|
],
|
2025-06-15 12:38:03 +00:00
|
|
|
resolvers: [
|
|
|
|
|
AntDesignVueResolver({
|
|
|
|
|
importStyle: 'less', // 可选: 'css' | 'less',根据你是否启用了 less 主题定制
|
|
|
|
|
}),
|
|
|
|
|
],
|
|
|
|
|
dts: 'src/types/auto-imports.d.ts',
|
2025-06-14 15:12:49 +00:00
|
|
|
dirs: [
|
2025-06-15 12:38:03 +00:00
|
|
|
'src/components',
|
2025-06-14 15:12:49 +00:00
|
|
|
'src/stores',
|
|
|
|
|
],
|
|
|
|
|
vueTemplate: true,
|
|
|
|
|
}),
|
|
|
|
|
Components({
|
|
|
|
|
dirs: ['src/components'],
|
|
|
|
|
extensions: ['vue', 'tsx'],
|
2025-06-15 12:38:03 +00:00
|
|
|
dts: 'src/types/components.d.ts',
|
2025-06-14 15:12:49 +00:00
|
|
|
deep: true,
|
|
|
|
|
directoryAsNamespace: false,
|
2025-06-15 12:38:03 +00:00
|
|
|
resolvers: [
|
|
|
|
|
AntDesignVueResolver({
|
|
|
|
|
importStyle: 'less', // 保持与 AutoImport 中一致
|
|
|
|
|
}),
|
|
|
|
|
],
|
2025-06-14 15:12:49 +00:00
|
|
|
}),
|
|
|
|
|
],
|
|
|
|
|
resolve: {
|
|
|
|
|
alias: {
|
|
|
|
|
'@': fileURLToPath(new URL('./src', import.meta.url))
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
})
|