练习仓库
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.

27 lines
691 B

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. // https://vite.dev/config/
  6. export default defineConfig({
  7. plugins: [
  8. vue(),
  9. vueDevTools(),
  10. ],
  11. resolve: {
  12. alias: {
  13. '@': fileURLToPath(new URL('./src', import.meta.url))
  14. },
  15. },
  16. server: {
  17. proxy: {
  18. '/api': { //请求路径中包含了/api
  19. target: 'http://39.101.133.168:8828/coupon', //要更换的源,也就是后台服务的源
  20. changeOrigin: true, //要不要更换源
  21. //rewrite: (path) => path.replace(/^\/api/, '') //路径重写/api替换为’’
  22. }
  23. }
  24. }
  25. })