vite.config.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. target: 'http://172.16.32.122:8001', //这里配置运行时服务地址
  47. secure: false, //如果运行时服务是https,此处配置为true
  48. changeOrigin: true //支持跨域调用,这里配置为true
  49. },
  50. '/bdp/dataservice/api': {
  51. target: 'http://172.16.32.183:8888', //这里配置运行时服务地址
  52. secure: false, //如果运行时服务是https,此处配置为true
  53. changeOrigin: true //支持跨域调用,这里配置为true
  54. },
  55. }
  56. },
  57. build: {
  58. chunkSizeWarningLimit: 1000,
  59. },
  60. })