icestark icon indicating copy to clipboard operation
icestark copied to clipboard

支持非阻塞的脚本资源

Open maoxiaoke opened this issue 3 years ago • 3 comments

背景

微应用存在加载一些三方脚本,这些脚本不是核心应用资源。当前这些资源加载失败后会直接导致应用加载失败。

方案

对于 entry 方式加载的脚本资源,若存在 async,则不阻塞后续脚本执行,并不影响后续脚本执行、页面渲染。

对于 url 配置的脚本资源,则扩展 url 的配置如下:

<AppRoute
  name="react",
  url={[{
      src: 'www.unblock.js',
      async: true
    },
    'www.block.js']}
  >
</AppRoute>

Relate issue

#585

maoxiaoke avatar May 10 '22 06:05 maoxiaoke

老哥,我在钉钉上加你好友了,上次跟你这边沟通,准备六月来迭代下这个需求

chencs-19950208 avatar May 31 '22 13:05 chencs-19950208

@chencs-19950208 可能大致就是这个方案了,可以直接提交 pr 就可以了

maoxiaoke avatar Jun 06 '22 13:06 maoxiaoke

好的

chencs-19950208 avatar Jun 07 '22 12:06 chencs-19950208