vite.config.ts 775 B

1234567891011121314151617181920212223242526272829303132333435
  1. import { fileURLToPath, URL } from 'node:url'
  2. import { defineConfig } from 'vite'
  3. import vue from '@vitejs/plugin-vue'
  4. //vite.config.ts 和 axios.config.ts和baiqi的版本有些许出入,若保留其版本无法正常登陆
  5. //目前用的还是xiaoyu的版本
  6. // https://vitejs.dev/config/
  7. export default defineConfig({
  8. //配置代理,解决跨域问题。详见EAI问题文档
  9. server: {
  10. host: '127.0.0.1',
  11. port: 4000,
  12. proxy: {
  13. '/api': {
  14. target: 'http://localhost:8080',
  15. changeOrigin: true,
  16. rewrite: (path) => path.replace(/^\/api/, ''),
  17. },
  18. },
  19. },
  20. plugins: [
  21. vue(),
  22. ],
  23. resolve: {
  24. alias: {
  25. '@': fileURLToPath(new URL('./src', import.meta.url))
  26. }
  27. },
  28. })