@lemon-fe/vite-plugin-micro-frontend 1.2.3 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -0
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/runtime-bridge.d.ts +76 -0
- package/dist/runtime-bridge.js +185 -0
- package/dist/runtime-bridge.js.map +1 -0
- package/dist/runtime-federation.d.ts +19 -0
- package/dist/runtime-federation.js +36 -0
- package/dist/runtime-federation.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -219,6 +219,25 @@ import { dynamic } from "@lemon-fe/vite-plugin-micro-frontend/runtime/dynamic";
|
|
|
219
219
|
import { renderWithQiankun } from "@lemon-fe/vite-plugin-micro-frontend/runtime/qiankun";
|
|
220
220
|
```
|
|
221
221
|
|
|
222
|
+
### 加载具名导出的联邦组件
|
|
223
|
+
|
|
224
|
+
生成的 `src/utils/mf.tsx` 支持通过 `exportName` 选择远程模块的具名导出:
|
|
225
|
+
|
|
226
|
+
```tsx
|
|
227
|
+
import type { FC } from "react";
|
|
228
|
+
import { safeRemoteComponent } from "@@/mf";
|
|
229
|
+
|
|
230
|
+
const Fallback: FC = () => null;
|
|
231
|
+
|
|
232
|
+
const RemoteButton = safeRemoteComponent<FC>({
|
|
233
|
+
moduleSpecifier: "base/components",
|
|
234
|
+
exportName: "Button",
|
|
235
|
+
fallbackComponent: Fallback,
|
|
236
|
+
});
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
未设置 `exportName` 时优先加载 `default`;如果模块没有默认导出且只有一个组件类型的具名导出,会自动加载该组件。存在多个组件类型的具名导出时必须明确设置 `exportName`。升级插件后需重新执行 `mf generate`,使业务项目中的 `mf.tsx` 与模板同步。
|
|
240
|
+
|
|
222
241
|
## 路由约定
|
|
223
242
|
|
|
224
243
|
路由插件遵循 UMI 风格的约定式路由:
|