vite.config.js 748 B

12345678910111213141516171819202122232425262728293031323334
  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. base: './',
  9. plugins: [
  10. vue(),
  11. Components(),
  12. svgBuilder({
  13. path: './src/assets/icons/',
  14. prefix: ''
  15. })
  16. ],
  17. resolve: {
  18. alias: {
  19. '@': fileURLToPath(new URL('./src', import.meta.url))
  20. }
  21. },
  22. server: {
  23. port: '3000',
  24. proxy: {
  25. '/api': {
  26. target: 'http://81.68.234.235:8910/',
  27. changeOrigin: true,
  28. rewrite: (path) => path.replace(/^\/api/, '') // 不可以省略rewrite
  29. }
  30. }
  31. }
  32. })