vite.config.ts 865 B

12345678910111213141516171819202122232425262728293031323334353637
  1. import { defineConfig } from 'vite'
  2. import vue from '@vitejs/plugin-vue'
  3. import Components from 'unplugin-vue-components/vite'
  4. import { VantResolver } from 'unplugin-vue-components/resolvers'
  5. import path from 'path'
  6. // https://vitejs.dev/config/
  7. export default defineConfig({
  8. base: '/wap/',
  9. plugins: [
  10. vue(),
  11. Components({
  12. resolvers: [VantResolver()]
  13. })
  14. ],
  15. resolve: {
  16. alias: {
  17. "@": path.resolve(__dirname, './src')
  18. }
  19. },
  20. server: {
  21. host: '0.0.0.0',
  22. port: 5173,
  23. open: true,
  24. proxy: {
  25. '/forward-service': {
  26. target: 'http://192.168.103.33:8585/',
  27. // target: 'http://192.168.100.115:8585/', // 生产环境
  28. changeOrigin: true,
  29. rewrite: (path) => {
  30. // console.log('path', path)
  31. return path.replace(/^\/forward-service/, '')
  32. }
  33. }
  34. }
  35. }
  36. })