You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
612 B

1 month ago
1 month ago
1 month ago
1 month ago
  1. import { fileURLToPath, URL } from 'node:url';
  2. import { defineConfig } from 'vite';
  3. import vue from '@vitejs/plugin-vue';
  4. import vueDevTools from 'vite-plugin-vue-devtools';
  5. export default defineConfig({
  6. server: {
  7. proxy: {
  8. '/api': {
  9. target: 'http://192.168.8.235:8000', // 后端服务器地址
  10. changeOrigin: true, // 改变请求源
  11. rewrite: (path) => path.replace(/^\/api/, '') // 重写路径,去掉 /api
  12. }
  13. }
  14. },
  15. plugins: [
  16. vue(),
  17. vueDevTools()
  18. ],
  19. resolve: {
  20. alias: {
  21. '@': fileURLToPath(new URL('./src', import.meta.url))
  22. }
  23. }
  24. });