vite.config.ts 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. changeOrigin: true,
  54. rewrite: (path) => path.replace(/^\/gym/, ""),
  55. },
  56. "^/colexiu/.*": {
  57. target: "https://online.colexiu.com",
  58. changeOrigin: true,
  59. rewrite: (path) => path.replace(/^\/colexiu/, ""),
  60. },
  61. "^/orchestra/.*": {
  62. target: "https://online.lexiaoya.cn",
  63. changeOrigin: true,
  64. rewrite: (path) => path.replace(/^\/orchestra/, ""),
  65. },
  66. },
  67. },
  68. });
  69. // vite.config.js