vite.config.js 581 B

1234567891011121314151617181920212223242526
  1. import { fileURLToPath, URL } from 'node:url'
  2. import { defineConfig } from 'vite'
  3. import vue from '@vitejs/plugin-vue'
  4. // https://vitejs.dev/config/
  5. export default defineConfig({
  6. plugins: [vue()],
  7. server: {
  8. host: true,
  9. port: 9999,
  10. proxy: {
  11. '/api': {
  12. target: 'http://10.113.248.4:8666/', //目标url
  13. changeOrigin: true, //支持跨域
  14. rewrite: (path) => path.replace(/^\/api/, ""),
  15. //重写路径,替换/api
  16. }
  17. }
  18. },
  19. resolve: {
  20. alias: {
  21. '@': fileURLToPath(new URL('./src', import.meta.url))
  22. }
  23. }
  24. })