vite.config.ts 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. import { defineConfig } from "vite";
  2. import vue from "@vitejs/plugin-vue";
  3. import vueJsx from "@vitejs/plugin-vue-jsx";
  4. import legacy from "@vitejs/plugin-legacy";
  5. import { resolve } from "path";
  6. import postCssPxToRem from "postcss-pxtorem";
  7. // https://vitejs.dev/config/
  8. export default defineConfig({
  9. base: "./",
  10. resolve: {},
  11. plugins: [
  12. // mkcert(), // 本地https
  13. legacy({
  14. targets: ['Chrome 63'],
  15. additionalLegacyPolyfills: ['regenerator-runtime/runtime'],
  16. modernPolyfills: true
  17. }),
  18. vue(),
  19. vueJsx(),
  20. ],
  21. css: {
  22. postcss: {
  23. plugins: [
  24. postCssPxToRem({
  25. rootValue: 37.5,
  26. propList: ["*"],
  27. selectorBlackList: [".norem"],
  28. }),
  29. ],
  30. },
  31. },
  32. build: {
  33. rollupOptions: {
  34. input: {
  35. index: resolve(__dirname, "index.html"),
  36. colexiu: resolve(__dirname, "colexiu.html"),
  37. orchestra: resolve(__dirname, "orchestra.html"),
  38. "report-share": resolve(__dirname, "report-share.html"),
  39. instrument: resolve(__dirname, "instrument.html"),
  40. },
  41. },
  42. },
  43. server: {
  44. cors: true,
  45. port: 3000,
  46. // https: true,
  47. proxy: {
  48. "^/gym/.*": {
  49. target: "https://mstutest.dayaedu.com",
  50. // target: "https://online.dayaedu.com",
  51. changeOrigin: true,
  52. rewrite: (path) => path.replace(/^\/gym/, ""),
  53. },
  54. "^/colexiu/.*": {
  55. target: "https://dev.colexiu.com",
  56. // target: "https://online.colexiu.com",
  57. changeOrigin: true,
  58. rewrite: (path) => path.replace(/^\/colexiu/, ""),
  59. },
  60. "^/orchestra/.*": {
  61. target: "https://test.lexiaoya.cn",
  62. changeOrigin: true,
  63. rewrite: (path) => path.replace(/^\/orchestra/, ""),
  64. },
  65. "^/instrument/.*": {
  66. // target: "https://kt.colexiu.com",
  67. target: "https://test.lexiaoya.cn",
  68. changeOrigin: true,
  69. rewrite: (path) => path.replace(/^\/instrument/, ""),
  70. },
  71. },
  72. },
  73. preview:{
  74. port: 3000,
  75. host: '192.168.3.114'
  76. }
  77. });
  78. // vite.config.js