vite.config.js 908 B

12345678910111213141516171819202122232425262728293031323334
  1. import { defineConfig } from "vite";
  2. import uni from "@dcloudio/vite-plugin-uni";
  3. import { visualizer } from "rollup-plugin-visualizer";
  4. export default defineConfig({
  5. plugins: [
  6. uni(),
  7. visualizer(),
  8. ],
  9. css: {
  10. preprocessorOptions: {
  11. scss: {
  12. silenceDeprecations: {
  13. 'legacy-js-api': true,
  14. 'color-functions': true,
  15. 'import': true,
  16. },
  17. },
  18. },
  19. },
  20. server: {
  21. host: "192.168.3.53", // 和后端 IP 一致
  22. port: 8300, // 跟后端端口一样(关键)
  23. strictPort: true, // 端口占用直接报错
  24. proxy: {
  25. '/yos/rest': { // 直接代理后端路径
  26. target: 'http://61.164.207.46:8300', // 真实后端
  27. changeOrigin: true,
  28. cookieDomainRewrite: "192.168.3.53", // 修改 Set-Cookie 的 Domain
  29. rewrite: (path) => path.replace(/^\/yos\/rest/, '/yos/rest')
  30. },
  31. },
  32. },
  33. });