vite.config.ts 868 B

123456789101112131415161718192021222324252627282930313233
  1. import { defineConfig } from 'vite';
  2. import vue from '@vitejs/plugin-vue'
  3. import vueJsx from '@vitejs/plugin-vue-jsx'
  4. import path from 'path';
  5. import fs from "fs";
  6. const pathResolve = (pathStr: string) => {
  7. return path.resolve(__dirname, pathStr);
  8. };
  9. module.exports = defineConfig({
  10. plugins: [vue(), vueJsx()],
  11. alias: {
  12. '@': pathResolve('./src'),
  13. },
  14. server: {
  15. // https: {
  16. // key: fs.readFileSync("./cert/6353984_jpcj-h5.zzxcx.net.key"),
  17. // cert: fs.readFileSync("./cert/6353984_jpcj-h5.zzxcx.net.pem"),
  18. // },
  19. proxy: {
  20. "/dev-api": {
  21. target: "https://jpcj-admin1.zzxcx.net/jpcj-admin",
  22. changeOrigin: true,
  23. rewrite: (path) => path.replace(/^\/dev-api/, ""),
  24. },
  25. "/prod-api": {
  26. target: "https://jpcj-admin.zzxcx.net/jpcj-admin",
  27. changeOrigin: true,
  28. rewrite: (path) => path.replace(/^\/prod-api/, ""),
  29. },
  30. },
  31. },
  32. });