vite.config.js 976 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. // host: '192.168.11.102',
  28. port: '9999',
  29. proxy: {
  30. ['/prod-api']: {
  31. // target: 'http://120.26.86.247:9898/',//实际请求地址
  32. // target: 'http://47.122.47.140:9898/',//实际请求地址
  33. target: 'http://haijiacheng.com:80/prod-api', //实际请求地址
  34. changeOrigin: true,
  35. // ws: true,// websocket支持
  36. rewrite: (path) => path.replace('/prod-api', '') //替换实际请求后台地址
  37. }
  38. },
  39. https: false
  40. }
  41. })