vite.config.ts 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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, "index-colexiu.html"),
  43. orchestra: resolve(__dirname, "index-orchestra.html"),
  44. },
  45. },
  46. },
  47. server: {
  48. cors: true,
  49. proxy: {
  50. "^/gym/.*": {
  51. target: "https://mstutest.dayaedu.com",
  52. changeOrigin: true,
  53. rewrite: (path) => path.replace(/^\/gym/, ""),
  54. },
  55. "^/colexiu/.*": {
  56. target: "http://dev.colexiu.cn",
  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. },
  66. },
  67. });
  68. // vite.config.js