vite.config.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. },
  24. plugins: [
  25. Icons({
  26. autoInstall: true,
  27. compiler: "vue3",
  28. }),
  29. VueSetupExtend(),
  30. vue({
  31. refTransform: true
  32. }),
  33. legacy({
  34. targets: 'chrome 49',
  35. }),
  36. AutoImport({
  37. dts: 'src/auto-imports.d.ts',
  38. imports: ['vue']
  39. })
  40. ],
  41. server: {
  42. host: '0.0.0.0',
  43. proxy: {
  44. '/emr/runtime': {
  45. target: 'http://172.16.32.122:8001', //这里配置运行时服务地址
  46. secure: false, //如果运行时服务是https,此处配置为true
  47. changeOrigin: true //支持跨域调用,这里配置为true
  48. },
  49. '/bdp/dataservice/api': {
  50. target: 'http://172.16.32.183:8888', //这里配置运行时服务地址
  51. secure: false, //如果运行时服务是https,此处配置为true
  52. changeOrigin: true //支持跨域调用,这里配置为true
  53. },
  54. }
  55. },
  56. build: {
  57. chunkSizeWarningLimit: 1000,
  58. },
  59. })