vite.config.ts 812 B

12345678910111213141516171819202122232425262728293031323334
  1. import { fileURLToPath, URL } from "node:url"
  2. import { defineConfig } from "vite"
  3. import vue from "@vitejs/plugin-vue"
  4. import vueJsx from "@vitejs/plugin-vue-jsx"
  5. // https://vite.dev/config/
  6. export default defineConfig({
  7. plugins: [vue(), vueJsx()],
  8. css: {
  9. preprocessorOptions: {
  10. scss: {
  11. additionalData: `@use "@/assets/variables.scss" as *;`
  12. }
  13. }
  14. },
  15. resolve: {
  16. alias: {
  17. "@": fileURLToPath(new URL("./src", import.meta.url))
  18. }
  19. },
  20. server: {
  21. port: 9525,
  22. host: "0.0.0.0",
  23. proxy: {
  24. // 正则表达式写法
  25. "^/rhythmApi/.*": {
  26. target: "https://test.kt.colexiu.com",
  27. changeOrigin: true,
  28. rewrite: path => path.replace(/^\/rhythmApi/, "")
  29. }
  30. }
  31. }
  32. })