vite.config.js 771 B

123456789101112131415161718192021222324252627282930313233343536
  1. import { fileURLToPath, URL } from 'node:url'
  2. import { defineConfig } from 'vite'
  3. import vue from '@vitejs/plugin-vue'
  4. import Components from 'unplugin-vue-components/vite'
  5. import { svgBuilder } from 'vite-svg-plugin'
  6. // https://vitejs.dev/config/
  7. export default defineConfig({
  8. build: {
  9. sourcemap: true,
  10. },
  11. plugins: [
  12. vue(),
  13. Components(),
  14. svgBuilder({
  15. path: './src/assets/icons/',
  16. prefix: ''
  17. })
  18. ],
  19. resolve: {
  20. alias: {
  21. '@': fileURLToPath(new URL('./src', import.meta.url))
  22. }
  23. },
  24. server: {
  25. port: '3000',
  26. proxy: {
  27. '/api': {
  28. target: 'http://81.68.234.235:8910/',
  29. changeOrigin: true,
  30. rewrite: (path) => path.replace(/^\/api/, '') // 不可以省略rewrite
  31. }
  32. }
  33. }
  34. })