vite.config.ts 977 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import { fileURLToPath, URL } from 'node:url'
  2. import AutoImport from 'unplugin-auto-import/vite'
  3. import Components from 'unplugin-vue-components/vite'
  4. import { NaiveUiResolver } from 'unplugin-vue-components/resolvers'
  5. import { defineConfig } from 'vite'
  6. import vue from '@vitejs/plugin-vue'
  7. // https://vitejs.dev/config/
  8. export default defineConfig({
  9. plugins: [
  10. vue(),
  11. AutoImport({
  12. imports: [
  13. 'vue',
  14. {
  15. 'naive-ui': [
  16. 'useDialog',
  17. 'useMessage',
  18. 'useNotification',
  19. 'useLoadingBar'
  20. ]
  21. }
  22. ]
  23. }),
  24. Components({
  25. resolvers: [NaiveUiResolver()]
  26. })
  27. ],
  28. resolve: {
  29. alias: {
  30. '@': fileURLToPath(new URL('./src', import.meta.url))
  31. }
  32. },
  33. server: {
  34. host: '0.0.0.0',
  35. proxy: {
  36. '/api': {
  37. target: 'http://localhost:8080',
  38. changeOrigin: true,
  39. rewrite: path => path.replace(/^\/api/, '')
  40. }
  41. }
  42. }
  43. })