vite.config.ts 946 B

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