originjs / vite-plugin-federation

Module Federation for vite & rollup
Other
2.26k stars 233 forks source link

使用 legacy 时,host 应用会出错 #297

Open VaJoy opened 1 year ago

VaJoy commented 1 year ago

remote 应用执行 vite serve 或 vite build 都正常,但 host 应用执行 vite serve 或 vite build 都会失败。

host 执行 serve 后,运行 http://localhost:5001/ 后,页面上的错误: image

host 执行 build 的错误:

image

我把该报错项目放在这里了。其使用的是官方 vue3-advanced-demo 修改的后的项目(主要改动点就是 remote 和 host 都加了 @vitejs/plugin-legacy,且 host 加上了 vite-plugin-top-level-await)。

VaJoy commented 1 year ago

另外提一下,remote 应用只要使用了 @vitejs/plugin-legacy,都必须给 filename 带上 -legacy 才能通过构建(不然会报错),这种隐藏逻辑也很奇怪。

同款问题见 https://github.com/vitejs/vite/issues/6133#issuecomment-1247815477

ruleeeer commented 1 year ago

It looks like the problem is caused by the fact that both plugins depend on the file name +-------------------------------------------------------------------------------------------------- 看起来是因为两个插件都依赖于文件名称导致的问题

Deuscx commented 1 year ago

同样的问题,有什么解决方法吗?

foreverstars commented 11 months ago

同样的问题,有什么解决方法吗?

Issues-translate-bot commented 11 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Same problem, any solution?

foreverstars commented 3 months ago

Same problem, any solution?

chenhw commented 2 months ago

any updates?

liuwanlong commented 1 month ago

same problem🥲