vite.config.ts 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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 timestamp = + new Date()
  7. // https://vitejs.dev/config/
  8. export default defineConfig({
  9. plugins: [vue(), vueJsx({})],
  10. resolve: {
  11. alias: {
  12. "@": path.resolve(__dirname, "src"),
  13. },
  14. },
  15. build: {
  16. rollupOptions: {
  17. output: {
  18. entryFileNames: `assets/[name].${timestamp}.js`,
  19. chunkFileNames: `assets/[name].${timestamp}.js`,
  20. assetFileNames: `assets/[name].${timestamp}.[ext]`
  21. }
  22. }
  23. },
  24. server: {
  25. host: "jpcj-h5.zzxcx.net",
  26. port: 443,
  27. https: {
  28. key: fs.readFileSync("./cert/6353984_jpcj-h5.zzxcx.net.key"),
  29. cert: fs.readFileSync("./cert/6353984_jpcj-h5.zzxcx.net.pem"),
  30. },
  31. proxy: {
  32. "/dev-api": {
  33. target: "https://jpcj1.zzxcx.net/jpcj-admin",
  34. changeOrigin: true,
  35. rewrite: (path) => path.replace(/^\/dev-api/, ""),
  36. },
  37. "/prod-api": {
  38. target: "https://jpcj1.zzxcx.net/jpcj-admin",
  39. changeOrigin: true,
  40. rewrite: (path) => path.replace(/^\/prod-api/, ""),
  41. },
  42. },
  43. },
  44. });