vite.config.ts 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. import { createStyleImportPlugin } from "vite-plugin-style-import";
  8. // https://vitejs.dev/config/
  9. export default defineConfig({
  10. base: "./",
  11. resolve: {},
  12. plugins: [
  13. legacy(),
  14. vue(),
  15. vueJsx(),
  16. createStyleImportPlugin({
  17. libs: [
  18. {
  19. libraryName: "vant",
  20. esModule: true,
  21. // resolveStyle: (name) => ,
  22. },
  23. ],
  24. }),
  25. ],
  26. css: {
  27. postcss: {
  28. plugins: [
  29. postCssPxToRem({
  30. rootValue: 37.5,
  31. propList: ["*"],
  32. selectorBlackList: [".norem"],
  33. }),
  34. ],
  35. },
  36. },
  37. build: {
  38. target: "esnext",
  39. rollupOptions: {
  40. input: {
  41. index: resolve(__dirname, "index.html"),
  42. colexiu: resolve(__dirname, "colexiu.html"),
  43. orchestra: resolve(__dirname, "orchestra.html"),
  44. },
  45. },
  46. },
  47. server: {
  48. cors: true,
  49. port: 3000,
  50. proxy: {
  51. "^/gym/.*": {
  52. // target: "https://mstutest.dayaedu.com",
  53. target: "https://online.dayaedu.com",
  54. changeOrigin: true,
  55. rewrite: (path) => path.replace(/^\/gym/, ""),
  56. },
  57. "^/colexiu/.*": {
  58. target: "https://online.colexiu.com",
  59. changeOrigin: true,
  60. rewrite: (path) => path.replace(/^\/colexiu/, ""),
  61. },
  62. "^/orchestra/.*": {
  63. target: "https://online.lexiaoya.cn",
  64. changeOrigin: true,
  65. rewrite: (path) => path.replace(/^\/orchestra/, ""),
  66. },
  67. },
  68. },
  69. });
  70. // vite.config.js