vite.config.ts 808 B

12345678910111213141516171819202122232425262728293031323334
  1. import { defineConfig } from 'vite'
  2. import vue from '@vitejs/plugin-vue'
  3. import path from 'path';
  4. import legacy from '@vitejs/plugin-legacy'
  5. export default defineConfig({
  6. plugins: [
  7. vue(),
  8. legacy({
  9. targets: ['ie >= 8'],
  10. additionalLegacyPolyfills: ['regenerator-runtime/runtime']
  11. })
  12. ],
  13. resolve: {
  14. alias: {
  15. '@': path.resolve(__dirname, './src')
  16. }
  17. },
  18. server: {
  19. host: '0.0.0.0',
  20. port: 3300,
  21. proxy: {
  22. '/forward-service': {
  23. target: 'https://iot.tuoren.com/forward-service', // 生产环境
  24. // target: 'http://192.168.100.249:8585', // 测试环境
  25. changeOrigin: true,
  26. rewrite: (path) => {
  27. // console.log('path', path)
  28. return path.replace(/^\/forward-service/, '')
  29. }
  30. }
  31. }
  32. }
  33. })