vite.config.ts 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /// <reference types="vitest" />
  2. import path from 'node:path'
  3. import { defineConfig } from 'vite'
  4. import Vue from '@vitejs/plugin-vue'
  5. import Pages from 'vite-plugin-pages'
  6. import Components from 'unplugin-vue-components/vite'
  7. import AutoImport from 'unplugin-auto-import/vite'
  8. import UnoCSS from 'unocss/vite'
  9. import VueMacros from 'unplugin-vue-macros/vite'
  10. export default defineConfig({
  11. resolve: {
  12. alias: {
  13. '~/': `${path.resolve(__dirname, 'src')}/`,
  14. },
  15. },
  16. plugins: [
  17. VueMacros({
  18. defineOptions: false,
  19. defineModels: false,
  20. plugins: {
  21. vue: Vue({
  22. script: {
  23. propsDestructure: true,
  24. defineModel: true,
  25. },
  26. }),
  27. },
  28. }),
  29. // https://github.com/hannoeru/vite-plugin-pages
  30. Pages(),
  31. // https://github.com/antfu/unplugin-auto-import
  32. AutoImport({
  33. imports: [
  34. 'vue',
  35. 'vue-router',
  36. '@vueuse/core',
  37. ],
  38. dts: true,
  39. dirs: [
  40. './src/composables',
  41. ],
  42. vueTemplate: true,
  43. }),
  44. // https://github.com/antfu/vite-plugin-components
  45. Components({
  46. dts: true,
  47. }),
  48. // https://github.com/antfu/unocss
  49. // see uno.config.ts for config
  50. UnoCSS(),
  51. ],
  52. // https://github.com/vitest-dev/vitest
  53. test: {
  54. environment: 'jsdom',
  55. },
  56. })