vite.config.js 992 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import {
  2. fileURLToPath,
  3. URL
  4. } from 'node:url'
  5. import {
  6. defineConfig
  7. } from 'vite'
  8. import vue from '@vitejs/plugin-vue'
  9. import AutoImport from 'unplugin-auto-import/vite';
  10. // https://vitejs.dev/config/
  11. export default defineConfig({
  12. plugins: [
  13. vue(),
  14. // 配置插件
  15. AutoImport({
  16. imports: ['vue', 'vue-router']
  17. })
  18. ],
  19. resolve: {
  20. alias: {
  21. '@': fileURLToPath(new URL('./src',
  22. import.meta.url))
  23. }
  24. },
  25. server: {
  26. host: true,
  27. open: true,
  28. // host: '192.168.11.102',
  29. port: '9999',
  30. proxy: {
  31. ['/prod-api']: {
  32. // target: 'http://120.26.86.247:9898/',//实际请求地址
  33. // target: 'http://47.122.47.140:9898/',//实际请求地址
  34. target: 'http://haijiacheng.com:80/prod-api', //实际请求地址
  35. changeOrigin: true,
  36. // ws: true,// websocket支持
  37. rewrite: (path) => path.replace('/prod-api', '') //替换实际请求后台地址
  38. }
  39. },
  40. https: false
  41. }
  42. })