vite.config.js 1.7 KB

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