vite.config.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. define: {
  17. __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: 'true'
  18. },
  19. esbuild: {
  20. jsxFactory: 'h',
  21. jsxFragment: 'Fragment'
  22. },
  23. externals: {
  24. "BMap": "BMap",
  25. "BMapLib": "BMapLib"
  26. },
  27. resolve: {
  28. alias,
  29. extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue']
  30. },
  31. plugins: [
  32. Icons({
  33. autoInstall: true,
  34. compiler: "vue3",
  35. }),
  36. VueSetupExtend(),
  37. vue(),
  38. AutoImport({
  39. dts: 'src/auto-imports.d.ts',
  40. imports: ['vue']
  41. })
  42. ],
  43. server: {
  44. host: '0.0.0.0',
  45. port: 3000,
  46. proxy: {
  47. '/emr/runtime': {
  48. //这里配置运行时服务地址
  49. target: 'http://172.16.32.125:8001/emr',
  50. secure: false, //如果运行时服务是https,此处配置为true
  51. changeOrigin: true, //支持跨域调用,这里配置为true
  52. rewrite: path => path.replace(/^\/emr/, '')
  53. },
  54. '/emr/archive': {
  55. //这里配置运行时服务地址
  56. target: 'http://172.16.32.125:8001/emr',
  57. secure: false, //如果运行时服务是https,此处配置为true
  58. changeOrigin: true, //支持跨域调用,这里配置为true
  59. rewrite: path => path.replace(/^\/emr/, '')
  60. },
  61. }
  62. },
  63. build: {
  64. chunkSizeWarningLimit: 1000,
  65. outDir: 'release/dist'
  66. },
  67. })