Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: 模块联邦host dev运行无法下载remote的@mf-types到本地 #6393

Closed
tky753 opened this issue Oct 16, 2024 · 4 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@tky753
Copy link

tky753 commented Oct 16, 2024

版本信息

System:
OS: Windows 11 10.0.22631
CPU: (6) x64 Intel(R) Core(TM) i5-9400F CPU @ 2.90GHz
Memory: 13.99 GB / 31.95 GB
Browsers:
Edge: Chromium (127.0.2651.74)
Internet Explorer: 11.0.22621.3527
npmPackages:
@modern-js/app-tools: 2.60.3 => 2.60.3
@modern-js/module-tools: 2.60.3 => 2.60.3
@modern-js/runtime: 2.60.3 => 2.60.3

问题详情

参照文档
host在dev时应该会自动下载remotes的@mf-types才对。
我之前用rsbuild+MF2的时候也确实会自动下载。
但现在转到modern.js后就不行了,试了实例项目,发现也不行。
我看 http://localhost:xxxx/mf-manifest.json 中明明是有metaData.types节点的,
调用 http://localhost:xxxx/@mf-types.zip 也确实能下载到内容

复现链接

https://github.com/web-infra-dev/modern-js-examples/tree/main/examples/module-federation/base

复现步骤

console1:
cd module-federation\base\remote
pnpm i
pnpm dev

console2:
cd module-federation\base\host
pnpm i
rm -rf @mf-types
pnpm dev

浏览器打开http://localhost:8080,console2 出现错误
Image

@tky753 tky753 added the bug Something isn't working label Oct 16, 2024
@zllkjc zllkjc self-assigned this Oct 16, 2024
@zllkjc
Copy link
Member

zllkjc commented Oct 16, 2024

我好像没有办法复现你的错误,升级到了 1.60.3,移除了 @mf-types,在运行 dev 的时候 MF 自动下载了类型。你通过 VSCode 能够跳转到指定的文件吗。

@tky753
Copy link
Author

tky753 commented Oct 16, 2024

有个同事电脑可以,我试了就不行,应该是我哪里配置有问题,我再看看吧。

@tky753 tky753 closed this as completed Oct 16, 2024
@tky753
Copy link
Author

tky753 commented Oct 17, 2024

应该不是modern.js的问题,我试了rsbuild的例子,也无法下载。把node升级到了最新,还尝试了yarn,还是不行。
不知道是不是系统的问题。
下一步要试的话,得要调试mf源码了,算了,懒得折腾了

@zllkjc
Copy link
Member

zllkjc commented Oct 18, 2024

有可能是你全局 ts 版本,或者上层目录 tsconfig.json 的问题等。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants