vite.config.ts 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. import components from "unplugin-vue-components/vite";
  9. import autoImport from "unplugin-auto-import/vite";
  10. import { VarletUIResolver, NaiveUiResolver } from "unplugin-vue-components/resolvers";
  11. // https://vitejs.dev/config/
  12. export default defineConfig({
  13. base: "./",
  14. resolve: {},
  15. plugins: [
  16. // mkcert(), // 本地https
  17. legacy({
  18. targets: "last 2 versions and not dead, > 0.3%, Firefox ESR",
  19. }),
  20. vue(),
  21. vueJsx(),
  22. // components({
  23. // resolvers: [NaiveUiResolver()],
  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. rollupOptions: {
  39. input: {
  40. index: resolve(__dirname, "index.html"),
  41. },
  42. },
  43. },
  44. server: {
  45. cors: true,
  46. port: 3050,
  47. // https: true,
  48. proxy: {
  49. "^/edu-app/.*": {
  50. // target: "https://test.lexiaoya.cn",
  51. target: "https://dev.kt.colexiu.com",
  52. changeOrigin: true,
  53. // rewrite: (path) => path.replace(/^\/edu-app/, ""),
  54. },
  55. },
  56. },
  57. });
  58. // vite.config.js