icestark icon indicating copy to clipboard operation
icestark copied to clipboard

修复 icestark App router prefetch 功能

Open huxfy opened this issue 1 year ago • 0 comments

现象:配置 approuter prefetch 后,实际未预加载微应用 router 相关资源 原因定位:AppRouter 内部在 construct 时,解析 React.children,进行微应用的 prefetch,这要求在 AppRouter 在构建时就需要提供所有微应用的 child。 修复方式:修改 @ice/plugin-icestark 插件中,对 AppRouter 的渲染方式,传入 apps,在 AppRouter 中,判定 apps 变化,做 prefetch。


构造方法时 prefetch https://github.com/ice-lab/icestark/blob/master/packages/icestark/src/AppRouter.tsx#L79

image

依赖 child https://github.com/ice-lab/icestark/blob/master/packages/icestark/src/AppRouter.tsx#L121 image

插件渲染时机 https://github.com/alibaba/ice/blob/master/packages/plugin-icestark/src/runtime/framework.tsx#L48 image image

huxfy avatar Apr 05 '24 03:04 huxfy