web-infra-dev / garfish

A powerful micro front-end framework 🚚

Home Page:https://www.garfishjs.org

Repository from Github https://github.comweb-infra-dev/garfishRepository from Github https://github.comweb-infra-dev/garfish

Garfish preload plugin

workkk98 opened this issue · comments

Clear and concise description of the problem

preload插件是为了预先加载一些子应用的入口文件。但子应用的加载顺序存在优先级,看源码中的方案是依赖子应用实际的加载数来排序的。这就引入了一个问题,有些新加的子应用可能是比原先子应用的优先级高很多。但是在刚引入该子应用时,可能是在最后加载。preload就没有起到它的作用。

Suggested solution

希望garfish,在run方法中可以传入一个初始化的子应用的优先级,且这个优先级是支持部分固化,部分动态计算。例如

interface AppRankRecord {
  [appName: string]: number
}

若应用已存在缓存,则覆写这个配置。优先从AppRankRecord中取出,余下的按照原先的方案排优先级。

Alternative

No response

Additional context

No response

Validations

  • Read the Contributing Guidelines.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
commented

感谢你的反馈,之前 Garfish 内置的 preload Plugin 内置的一些规则确实无法满足用户的一些诉求,基于这个原因我们提供了 preloadApp API ,通过这个 API,你可以根据自己的加载规则和想法去封装自己的 plugin 进行预加载

感谢你的反馈,之前 Garfish 内置的 preload Plugin 内置的一些规则确实无法满足用户的一些诉求,基于这个原因我们提供了 preloadApp API ,通过这个 API,你可以根据自己的加载规则和想法去封装自己的 plugin 进行预加载

preloadApp这个api是否能多提供个immediately参数,用来透传给loadAppResource呢

commented

preloadApp 本身就是立即执行的