vite.config.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import { defineConfig } from "vite";
  2. import vue from "@vitejs/plugin-vue";
  3. import { resolve } from "path";
  4. // vue setup 的糖语法
  5. import VueSetupExtend from "vite-plugin-vue-setup-extend";
  6. // 不用导入 vue 的 import 了
  7. import AutoImport from "unplugin-auto-import/vite";
  8. import Icons from "unplugin-icons/vite";
  9. import vueJsx from "@vitejs/plugin-vue-jsx";
  10. const pathResolve = dir => {
  11. return resolve(__dirname, ".", dir);
  12. };
  13. const alias = {
  14. "@": pathResolve("src"),
  15. };
  16. export default defineConfig({
  17. define: {
  18. __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: "true",
  19. },
  20. esbuild: {
  21. jsxFactory: "h",
  22. jsxFragment: "Fragment",
  23. },
  24. externals: {
  25. BMap: "BMap",
  26. BMapLib: "BMapLib",
  27. },
  28. resolve: {
  29. alias,
  30. extensions: [".mjs", ".js", ".ts", ".jsx", ".tsx", ".json", ".vue"],
  31. },
  32. plugins: [
  33. Icons({
  34. autoInstall: true,
  35. compiler: "vue3",
  36. }),
  37. VueSetupExtend(),
  38. vue(),
  39. vueJsx(),
  40. AutoImport({
  41. dts: "src/auto-imports.d.ts",
  42. imports: ["vue"],
  43. }),
  44. ],
  45. server: {
  46. host: "0.0.0.0",
  47. port: 3000,
  48. proxy: {
  49. "/emr": {
  50. //这里配置运行时服务地址
  51. target: "http://172.16.32.125:8001/emr",
  52. secure: false, //如果运行时服务是https,此处配置为true
  53. changeOrigin: true, //支持跨域调用,这里配置为true
  54. rewrite: path => path.replace(/^\/emr/, ""),
  55. },
  56. "/doctorSignatureImage": {
  57. target: "http://172.16.32.167:8077",
  58. secure: false, //如果运行时服务是https,此处配置为true
  59. changeOrigin: true, //支持跨域调用,这里配置为true
  60. rewrite: path => path.replace(/^\/emr/, ""),
  61. },
  62. },
  63. },
  64. build: {
  65. chunkSizeWarningLimit: 1000,
  66. outDir: "release/dist",
  67. },
  68. });