AA周年庆后台前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
850 B

4 weeks ago
4 weeks ago
1 month ago
4 weeks ago
1 month ago
4 weeks ago
4 weeks ago
  1. import { defineConfig } from 'vite';
  2. import vue from '@vitejs/plugin-vue';
  3. import path from 'path';
  4. export default defineConfig({
  5. // 设置打包后静态资源的基础路径为 testBack
  6. base: '/testBack/',
  7. plugins: [vue()],
  8. resolve: {
  9. alias: {
  10. '@': path.resolve(__dirname, './src')
  11. }
  12. },
  13. server: {
  14. proxy: {
  15. '/api': {
  16. target: 'https://dbqb.nfdxy.net', // 后端基础地址
  17. changeOrigin: true,
  18. rewrite: (path) => path.replace(/^\/api/, ''), // 移除 /api 前缀
  19. // 或者更精确的重写(根据后端路径调整):
  20. // rewrite: (path) => path.replace(/^\/api\/admin/, '/admin'),
  21. },
  22. '/upload': {
  23. target: 'http://39.101.133.168:8828',
  24. changeOrigin: true,
  25. rewrite: (path) => path.replace(/^\/upload/, ''),
  26. }
  27. },
  28. },
  29. },
  30. );