vite.config.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. AutoImport({
  36. dts: 'src/auto-imports.d.ts',
  37. imports: ['vue']
  38. })
  39. ],
  40. server: {
  41. host: '0.0.0.0',
  42. port: 3000,
  43. proxy: {
  44. '/emr/runtime': {
  45. //这里配置运行时服务地址
  46. target: 'http://172.16.32.125:8001/emr',
  47. secure: false, //如果运行时服务是https,此处配置为true
  48. changeOrigin: true, //支持跨域调用,这里配置为true
  49. rewrite: path => path.replace(/^\/emr/, '')
  50. },
  51. '/emr/archive': {
  52. //这里配置运行时服务地址
  53. target: 'http://172.16.32.125:8001/emr',
  54. secure: false, //如果运行时服务是https,此处配置为true
  55. changeOrigin: true, //支持跨域调用,这里配置为true
  56. rewrite: path => path.replace(/^\/emr/, '')
  57. },
  58. }
  59. },
  60. build: {
  61. chunkSizeWarningLimit: 1000,
  62. outDir: 'release/dist'
  63. },
  64. })