vite.config.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import { defineConfig } from 'vite';
  2. import react from '@vitejs/plugin-react';
  3. import path from 'path';
  4. import eslintPlugin from 'vite-plugin-eslint';
  5. import fs from 'fs';
  6. // https://vitejs.dev/config/
  7. export default defineConfig({
  8. base: '/callapp/',
  9. plugins: [
  10. react(),
  11. // 配置eslint检查的目录
  12. eslintPlugin({
  13. include: ['src/**/*.js', 'src/**/*.jsx'],
  14. }),
  15. ],
  16. resolve: {
  17. alias: {
  18. '@components': path.resolve(__dirname, './src/components'),
  19. '@pages': path.resolve(__dirname, './src/pages'),
  20. '@assets': path.resolve(__dirname, './src/assets'),
  21. '@api': path.resolve(__dirname, './src/api'),
  22. '@utils': path.resolve(__dirname, './src/utils'),
  23. },
  24. },
  25. server: {
  26. host: '0.0.0.0',
  27. hmr: true, // 关闭热更新 http://m00.puruiit.cn:3596
  28. proxy: {
  29. // https://np.h03.p0551.com http://10.1.2.29:8090
  30. '/bdhealth/': {
  31. target: 'http://m00.puruiit.cn:3596/bdhealth/',
  32. changeOrigin: true,
  33. rewrite: (path) => path.replace(/^\/bdhealth\//, ''),
  34. },
  35. },
  36. },
  37. });