vite.config.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. const pathResolve = (dir) => {
  10. return resolve(__dirname, '.', dir)
  11. }
  12. const alias = {
  13. '@': pathResolve('src'),
  14. }
  15. export default defineConfig({
  16. esbuild: {
  17. jsxFactory: 'h',
  18. jsxFragment: 'Fragment'
  19. },
  20. externals: {
  21. "BMap": "BMap",
  22. "BMapLib": "BMapLib"
  23. },
  24. resolve: {
  25. alias,
  26. extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue']
  27. },
  28. plugins: [
  29. Icons({
  30. autoInstall: true,
  31. compiler: "vue3",
  32. }),
  33. VueSetupExtend(),
  34. vue({
  35. refTransform: true
  36. }),
  37. AutoImport({
  38. dts: 'src/auto-imports.d.ts',
  39. imports: ['vue']
  40. })
  41. ],
  42. server: {
  43. host: '0.0.0.0',
  44. port: 3000,
  45. proxy: {
  46. '/emr/runtime': {
  47. //这里配置运行时服务地址
  48. target: 'http://172.16.32.125:8001/emr',
  49. secure: false, //如果运行时服务是https,此处配置为true
  50. changeOrigin: true, //支持跨域调用,这里配置为true
  51. rewrite: path => path.replace(/^\/emr/, '')
  52. },
  53. '/emr/archive': {
  54. //这里配置运行时服务地址
  55. target: 'http://172.16.32.125:8001/emr',
  56. secure: false, //如果运行时服务是https,此处配置为true
  57. changeOrigin: true, //支持跨域调用,这里配置为true
  58. rewrite: path => path.replace(/^\/emr/, '')
  59. },
  60. '/bdp/dataservice/api': {
  61. // 这个地址是,创智和宇的查询电子病历下拉框的接口
  62. target: 'http://172.16.32.183:8888',
  63. secure: false,
  64. changeOrigin: true
  65. },
  66. }
  67. },
  68. build: {
  69. chunkSizeWarningLimit: 1000,
  70. outDir: 'release/dist'
  71. },
  72. })