vite.config.ts 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import { fileURLToPath, URL } from 'node:url'
  2. import { defineConfig } from 'vite'
  3. import vue from '@vitejs/plugin-vue'
  4. import vueJsx from '@vitejs/plugin-vue-jsx'
  5. import vueDevTools from 'vite-plugin-vue-devtools'
  6. //import { viteMockServe } from 'vite-plugin-mock'
  7. // https://vitejs.dev/config/
  8. export default defineConfig({
  9. plugins: [
  10. vue(),
  11. vueJsx(),
  12. vueDevTools(),
  13. // viteMockServe({
  14. // mockPath: 'mock',
  15. // logger: true // 打印 mock请求日志
  16. // })
  17. ],
  18. // resolve: {
  19. // alias: [
  20. // {
  21. // find: '@',
  22. // replacement: fileURLToPath(new URL('./src', import.meta.url))
  23. // },
  24. // {
  25. // find: '@element-plus/icons-vue',
  26. // replacement: '@cacp/svg-icons'
  27. // },
  28. // {
  29. // find: /^@cacp\/ui(\/(es|lib))?$/,
  30. // replacement: fileURLToPath(
  31. // new URL('/home/dujianyong/桌面/cacp-ui-web/packages/cacp-ui/index.ts', import.meta.url)
  32. // )
  33. // }
  34. // ]
  35. // },
  36. resolve: {
  37. alias: {
  38. '@': fileURLToPath(new URL('./src', import.meta.url)),
  39. '@element-plus/icons-vue': '@cacp/svg-icons'
  40. }
  41. },
  42. server: {
  43. port: 8080,
  44. // 是否自动在浏览器打开
  45. open: true
  46. }
  47. })