vite.config.ts 931 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. import { URL, fileURLToPath } from 'node:url'
  2. import { defineConfig } from 'vite'
  3. import vue from '@vitejs/plugin-vue'
  4. import UnoCSS from 'unocss/vite'
  5. import Components from 'unplugin-vue-components/vite'
  6. import AutoImport from 'unplugin-auto-import/vite'
  7. import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
  8. // https://vitejs.dev/config/
  9. export default defineConfig({
  10. plugins: [
  11. vue(),
  12. UnoCSS(),
  13. Components({
  14. dts: true,
  15. resolvers: [ElementPlusResolver()],
  16. }),
  17. AutoImport({
  18. dts: true, // or a custom path
  19. include: [
  20. /\.[tj]sx?$/, // .ts, .tsx, .js, .jsx
  21. /\.vue$/,
  22. /\.vue\?vue/, // .vue
  23. /\.md$/, // .md
  24. ],
  25. imports: [
  26. 'vue',
  27. 'vue-router',
  28. ],
  29. resolvers: [ElementPlusResolver()],
  30. }),
  31. ],
  32. resolve: {
  33. alias: {
  34. '@': fileURLToPath(new URL('./src', import.meta.url)),
  35. },
  36. },
  37. })