vite.config.ts 866 B

12345678910111213141516171819202122232425262728293031323334
  1. import { fileURLToPath, URL } from 'node:url'
  2. import { defineConfig } from 'vite'
  3. import vue from '@vitejs/plugin-vue'
  4. import vueJsx from '@vitejs/plugin-vue-jsx'
  5. const host = '0.0.0.0'
  6. const port = 8445
  7. const apiLocalProxyRewrite = (path: string) => `/static${path}`
  8. // https://vitejs.dev/config/
  9. export default defineConfig({
  10. plugins: [vue(), vueJsx()],
  11. resolve: {
  12. alias: {
  13. '@': fileURLToPath(new URL('./src', import.meta.url))
  14. }
  15. },
  16. server: {
  17. host,
  18. port,
  19. proxy: {
  20. '/api': {
  21. // target: 'http://shw.themoretech.com:31005/',
  22. // target: 'http://192.168.1.6:31009',
  23. target: 'http://shw.themoretech.com:31008/',
  24. // target: `http://${host}:${port}/`,
  25. // rewrite: apiLocalProxyRewrite,
  26. changeOrigin: true
  27. // rewrite: path => path.replace(/^\/api/, '')
  28. }
  29. }
  30. }
  31. })