vite.config.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. plugins: [
  30. Icons({
  31. autoInstall: true,
  32. compiler: "vue3",
  33. }),
  34. VueSetupExtend(),
  35. vue({
  36. refTransform: true
  37. }),
  38. legacy({
  39. targets: 'chrome 49',
  40. }),
  41. AutoImport({
  42. dts: 'src/auto-imports.d.ts',
  43. imports: ['vue']
  44. })
  45. ],
  46. server: {
  47. host: '0.0.0.0',
  48. proxy: {
  49. '/emr': {
  50. //这里配置运行时服务地址
  51. target: 'http://172.16.32.125:8001/emr',
  52. secure: false, //如果运行时服务是https,此处配置为true
  53. changeOrigin: true, //支持跨域调用,这里配置为true
  54. },
  55. '/bdp/dataservice/api': {
  56. // 这个地址是,创智和宇的查询电子病历下拉框的接口
  57. target: 'http://172.16.32.183:8888',
  58. secure: false,
  59. changeOrigin: true
  60. },
  61. }
  62. },
  63. build: {
  64. chunkSizeWarningLimit: 1000,
  65. },
  66. })