在remote端和host端不共享element-plus 分别按需加载,导致依赖 provide/inject 的组件上下文失效。
Versions
- vite-plugin-federation:
- vite:
Reproduction
Additional Details
Steps to reproduce
What is Expected?
What is actually happening?
Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑🤝🧑👫🧑🏿🤝🧑🏻👩🏾🤝👨🏿👬🏿
Title: element-plus is not shared on the remote side and the host side and is loaded on demand respectively, causing the component context that relies on provide/inject to become invalid.
autoImport({ imports: ["vue", "vue-router", "pinia"], resolvers: [OuryunPlusResolver(ElementPlusResolver), ElementPlusResolver({ importStyle: "sass" })], // 声明文件生成 dts: false, }), Components({ resolvers: [OuryunPlusResolver(ElementPlusResolver), ElementPlusResolver({ importStyle: "sass" })], dts: false, }),
Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑🤝🧑👫🧑🏿🤝🧑🏻👩🏾🤝👨🏿👬🏿
autoImport({ imports: ["vue", "vue-router", "pinia"], resolvers: [OuryunPlusResolver(ElementPlusResolver), ElementPlusResolver({ importStyle: "sass" })], // 声明文件生成 dts: false, }), Components({ resolvers: [OuryunPlusResolver(ElementPlusResolver), ElementPlusResolver({ importStyle: "sass" })], dts: false, }),
实际产生的问题是 Element Plus 的 Form、Tabs 等组件大量依赖 provide/inject 导致 form表单校验不生效以及 el-tab 切换不生效
Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑🤝🧑👫🧑🏿🤝🧑🏻👩🏾🤝👨🏿👬🏿
The actual problem is that Element Plus' Form, Tabs and other components rely heavily on provide/inject, resulting in form verification not taking effect and el-tab switching not taking effect.