vite.config.js 885 B

12345678910111213141516171819202122232425262728293031
  1. import { defineConfig } from 'vite';
  2. import react from '@vitejs/plugin-react-swc';
  3. import path, { resolve } from 'path';
  4. import { fileURLToPath } from 'node:url';
  5. var __filename = fileURLToPath(import.meta.url);
  6. var __dirname = path.dirname(__filename);
  7. // https://vitejs.dev/config/
  8. export default defineConfig({
  9. plugins: [react()],
  10. build: {
  11. target: "esnext",
  12. },
  13. resolve: {
  14. alias: {
  15. '@src': resolve(__dirname, 'src'),
  16. '@assets': resolve(__dirname, 'assets'),
  17. '@': resolve(__dirname, '.'),
  18. }
  19. },
  20. server: {
  21. host: '0.0.0.0',
  22. port: 3305,
  23. proxy: {
  24. '/api': {
  25. target: 'https://testadmin.piaoquantv.com/',
  26. changeOrigin: true,
  27. rewrite: function (path) { return path.replace(/^\/api/, ''); },
  28. }
  29. }
  30. }
  31. });