vite.config.js 648 B

123456789101112131415161718192021222324252627282930
  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. server: {
  7. https: false,
  8. // 是否自动在浏览器打开
  9. open: true,
  10. cors: true,
  11. proxy: {
  12. '/api': {
  13. target: 'http://127.0.0.1:8000', // 接口域名,接口服务器地止
  14. changeOrigin: true,
  15. secure: false,
  16. // rewrite: (path) => path.replace(/^\/api/, '')
  17. },
  18. }
  19. },
  20. plugins: [
  21. vue(),
  22. ],
  23. resolve: {
  24. alias: {
  25. '@': fileURLToPath(new URL('./src', import.meta.url))
  26. }
  27. }
  28. })