1
0

vite.config.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import { fileURLToPath, URL } from "node:url";
  2. import { defineConfig } from "vite";
  3. import legacy from "@vitejs/plugin-legacy";
  4. import vue2 from "@vitejs/plugin-vue2";
  5. import vue2Jsx from "@vitejs/plugin-vue2-jsx";
  6. // https://vitejs.dev/config/
  7. export default defineConfig({
  8. plugins: [
  9. vue2(),
  10. vue2Jsx(),
  11. legacy({
  12. targets: ['IE 11'],
  13. additionalLegacyPolyfills: ["regenerator-runtime/runtime"],
  14. }),
  15. ],
  16. resolve: {
  17. alias: {
  18. "@": fileURLToPath(new URL("./src", import.meta.url)),
  19. },
  20. },
  21. server: {
  22. // 是否开启 https
  23. https: false,
  24. // 端口号
  25. // port: 3000,
  26. // 监听所有地址
  27. host: "0.0.0.0",
  28. // 服务启动时是否自动打开浏览器
  29. open: true,
  30. // 允许跨域
  31. cors: true,
  32. // 自定义代理规则
  33. proxy: {
  34. "/camera-api": {
  35. target: "https://ycjk.cq119.gov.cn",
  36. changeOrigin: true,
  37. rewrite: (path) => path.replace(/^\/camera-api/, ""),
  38. }
  39. },
  40. },
  41. build: {
  42. // 构建后是否生成 source map 文件
  43. sourcemap: false,
  44. // chunk 大小警告的限制(以 kbs 为单位)
  45. chunkSizeWarningLimit: 2000,
  46. // 启用/禁用 gzip 压缩大小报告
  47. reportCompressedSize: false,
  48. },
  49. });