vite.config.ts 785 B

12345678910111213141516171819202122232425262728293031323334353637
  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. base: "",
  7. plugins: [vue()],
  8. css: {
  9. preprocessorOptions: {
  10. scss: {
  11. additionalData: `
  12. @use "@/assets/styles/variable.scss" as *;
  13. @use "@/assets/styles/mixin.scss" as *;
  14. `
  15. }
  16. }
  17. },
  18. resolve: {
  19. alias: {
  20. "@": fileURLToPath(new URL("./src", import.meta.url))
  21. }
  22. },
  23. server: {
  24. port: 9527,
  25. host: "0.0.0.0",
  26. proxy: {
  27. // 正则表达式写法
  28. "^/pptApi/.*": {
  29. target: "https://test.kt.colexiu.com",
  30. changeOrigin: true,
  31. rewrite: path => path.replace(/^\/pptApi/, "")
  32. }
  33. }
  34. }
  35. })