vite.config.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. import {defineConfig} from 'vite'
  2. import legacy from '@vitejs/plugin-legacy'
  3. import vue from '@vitejs/plugin-vue'
  4. import {resolve} from 'path'
  5. // vue setup 的糖语法
  6. import VueSetupExtend from 'vite-plugin-vue-setup-extend'
  7. // 不用导入 vue 的 import 了
  8. import AutoImport from 'unplugin-auto-import/vite'
  9. import Icons from "unplugin-icons/vite";
  10. const pathResolve = (dir) => {
  11. return resolve(__dirname, '.', dir)
  12. }
  13. const alias = {
  14. '@': pathResolve('src'),
  15. }
  16. export default defineConfig({
  17. esbuild: {
  18. jsxFactory: 'h',
  19. jsxFragment: 'Fragment'
  20. },
  21. externals: {
  22. "BMap": "BMap",
  23. "BMapLib": "BMapLib"
  24. },
  25. resolve: {
  26. alias,
  27. extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue']
  28. },
  29. optimizeDeps: {
  30. include: [
  31. `monaco-editor/esm/vs/language/json/json.worker`,
  32. `monaco-editor/esm/vs/language/css/css.worker`,
  33. `monaco-editor/esm/vs/language/html/html.worker`,
  34. `monaco-editor/esm/vs/language/typescript/ts.worker`,
  35. `monaco-editor/esm/vs/editor/editor.worker`
  36. ],
  37. },
  38. plugins: [
  39. Icons({
  40. autoInstall: true,
  41. compiler: "vue3",
  42. }),
  43. VueSetupExtend(),
  44. vue({
  45. refTransform: true
  46. }),
  47. legacy({
  48. targets: 'chrome 49',
  49. }),
  50. AutoImport({
  51. dts: 'src/auto-imports.d.ts',
  52. imports: ['vue']
  53. })
  54. ],
  55. server: {
  56. host: '0.0.0.0',
  57. port: 3000,
  58. proxy: {
  59. '/emr/runtime': {
  60. //这里配置运行时服务地址
  61. target: 'http://172.16.32.125:8001/emr',
  62. secure: false, //如果运行时服务是https,此处配置为true
  63. changeOrigin: true, //支持跨域调用,这里配置为true
  64. rewrite: path => path.replace(/^\/emr/, '')
  65. },
  66. '/emr/archive': {
  67. //这里配置运行时服务地址
  68. target: 'http://172.16.32.125:8001/emr',
  69. secure: false, //如果运行时服务是https,此处配置为true
  70. changeOrigin: true, //支持跨域调用,这里配置为true
  71. rewrite: path => path.replace(/^\/emr/, '')
  72. },
  73. '/bdp/dataservice/api': {
  74. // 这个地址是,创智和宇的查询电子病历下拉框的接口
  75. target: 'http://172.16.32.183:8888',
  76. secure: false,
  77. changeOrigin: true
  78. },
  79. }
  80. },
  81. build: {
  82. chunkSizeWarningLimit: 1000,
  83. },
  84. })