optimize.ts 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /**
  2. * 此文件作用于 `vite.config.ts` 的 `optimizeDeps.include` 依赖预构建配置项
  3. * 依赖预构建,`vite` 启动时会将下面 include 里的模块,编译成 esm 格式并缓存到 node_modules/.vite 文件夹,页面加载到对应模块时如果浏览器有缓存就读取浏览器缓存,如果没有会读取本地缓存并按需加载
  4. * 尤其当您禁用浏览器缓存时(这种情况只应该发生在调试阶段)必须将对应模块加入到 include里,否则会遇到开发环境切换页面卡顿的问题(vite 会认为它是一个新的依赖包会重新加载并强制刷新页面),因为它既无法使用浏览器缓存,又没有在本地 node_modules/.vite 里缓存
  5. * 温馨提示:如果您使用的第三方库是全局引入,也就是引入到 src/main.ts 文件里,就不需要再添加到 include 里了,因为 vite 会自动将它们缓存到 node_modules/.vite
  6. */
  7. export const include = [
  8. "qs",
  9. "mitt",
  10. "xlsx",
  11. "dayjs",
  12. "axios",
  13. "pinia",
  14. "swiper",
  15. "lodash",
  16. "echarts",
  17. "intro.js",
  18. "vue-i18n",
  19. "xe-utils",
  20. "vxe-table",
  21. "js-cookie",
  22. "lodash-es",
  23. "cropperjs",
  24. "jsbarcode",
  25. "sortablejs",
  26. "swiper/vue",
  27. "@vueuse/core",
  28. "vue3-danmaku",
  29. "v-contextmenu",
  30. "vue-pdf-embed",
  31. "lodash-unified",
  32. "@ctrl/tinycolor",
  33. "china-area-data",
  34. "@faker-js/faker",
  35. "vue-json-pretty",
  36. "@logicflow/core",
  37. "@pureadmin/utils",
  38. "vue3-markdown-it",
  39. "responsive-storage",
  40. "@howdyjs/mouse-menu",
  41. "@logicflow/extension",
  42. "element-resize-detector",
  43. "@amap/amap-jsapi-loader",
  44. "el-table-infinite-scroll",
  45. "@wangeditor/editor-for-vue",
  46. "xgplayer/dist/simple_player",
  47. "xgplayer/es/controls/volume",
  48. "vuedraggable/src/vuedraggable",
  49. "xgplayer/es/controls/screenShot",
  50. "xgplayer/es/controls/playbackRate"
  51. ];