vite.config.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import { defineConfig } from 'vite'
  2. import vue from '@vitejs/plugin-vue'
  3. import vueJsx from '@vitejs/plugin-vue-jsx'
  4. const path = require('path')
  5. // https://vitejs.dev/config/
  6. export default defineConfig(({ command, mode }) => {
  7. console.log(command, mode)
  8. return {
  9. plugins: [vue(), vueJsx()],
  10. base: './',
  11. resolve: {
  12. alias: {
  13. '@': '/src'
  14. }
  15. },
  16. build: {
  17. outDir: `dist/${mode === 'production' ? 'merchant' : mode}`
  18. },
  19. optimizeDeps: { include: ['moment/locale/zh-cn'] },
  20. server: {
  21. proxy: {
  22. '/api': {
  23. // target: 'https://pdev.cleartv.cn/cticketmember/',
  24. target: 'https://potadev.cleartv.cn/',
  25. changeOrigin: true,
  26. rewrite: (path) => path.replace(/^\/api/, '')
  27. },
  28. '/tenant': {
  29. // target: 'https://pdev.cleartv.cn/cticketmember/',
  30. target: 'https://oriented-quail-refined.ngrok-free.app/',
  31. changeOrigin: true,
  32. rewrite: (path) => path.replace(/^\/api/, '')
  33. }
  34. }
  35. }
  36. }
  37. })