Tencent / hel

A module federation SDK which is unrelated to tool chain for module consumer. 工具链无关的运行时模块联邦sdk.
https://tencent.github.io/hel/
Other
931 stars 79 forks source link

组件同时preFetchLib,经常会失败,会是什么情况,请问下有没有遇到过或者可能什么原因 #68

Closed haibins closed 1 year ago

haibins commented 1 year ago

代码是这样

image

这是一个加载不出来的情况,大部分情况是这样

image image

这是正常加载出来的情况,小概率成功

image image

这是什么原因呢?

haibins commented 1 year ago

有一个会一直处于pending状态

fantasticsoul commented 1 year ago

你是请求的unpkg的还是你本地的呢,如果是unpkg的可以贴一个最小可复现的例子吗,如果是本地的,你确保你两个子模块里src的LIB_NAME 声明没有重复哈,这个很重要

haibins commented 1 year ago

你是请求的unpkg的还是你本地的呢,如果是unpkg的可以贴一个最小可复现的例子吗,如果是本地的,你确保你两个子模块里src的LIB_NAME 声明没有重复哈,这个很重要

image

是这样的,我两个组件分别请求的的是一个本地的,一个unpkg的包,但是版本是不一样的。LIB_NAME是一致的,就相当于请求同一个包的不同版本,这样会有问题吗

haibins commented 1 year ago
image image

这是两个组件同时请求的unpkg的同一个包的不同版本,这样是可以的。但是有一个换成本地的就不行了,就像这样

image
fantasticsoul commented 1 year ago

升级到最新版本hel-micro,请求本地开发模块时配置下 custom.trust = true 看下能否解决

// 类似
preFetchLIb('xx', {
  custom: { host: 'localhost:7000', trust: true }
})
fantasticsoul commented 1 year ago

已提供的可复现问题示例:https://github.com/haibins/remote-demo-master

fantasticsoul commented 1 year ago

经讨论,降低webpack chunk 数量后此问题不再复现

fantasticsoul commented 1 year ago

close issue