Skip to content

Commit 17e2d05

Browse files
Merge branch 'main' into app-router-support
2 parents 6afefd8 + 677aac9 commit 17e2d05

File tree

94 files changed

+505
-107
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+505
-107
lines changed

.changeset/swift-kiwis-argue.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@module-federation/bridge-shared': patch
3+
'@module-federation/bridge-vue3': patch
4+
---
5+
6+
vue.js has router option added to the vue3-bridge

apps/modernjs-ssr/dynamic-nested-remote/src/components/Content.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ import Button from 'antd/lib/button';
33
import {
44
registerRemotes,
55
loadRemote,
6-
createRemoteSSRComponent,
7-
} from '@modern-js/runtime/mf';
6+
kit,
7+
} from '@module-federation/modern-js/runtime';
88
import stuff from './stuff.module.css';
99

10+
const { createRemoteSSRComponent } = kit;
11+
1012
registerRemotes([
1113
{
1214
name: 'dynamic_remote',

apps/modernjs-ssr/host/src/routes/all/page.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import React, { Suspense } from 'react';
2-
import { loadRemote, registerRemotes } from '@modern-js/runtime/mf';
2+
import {
3+
loadRemote,
4+
registerRemotes,
5+
} from '@module-federation/modern-js/runtime';
36

47
registerRemotes([
58
{

apps/modernjs-ssr/host/src/routes/dynamic-nested-remote/page.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import React from 'react';
2-
import { loadRemote, registerRemotes } from '@modern-js/runtime/mf';
2+
import {
3+
loadRemote,
4+
registerRemotes,
5+
} from '@module-federation/modern-js/runtime';
36

47
registerRemotes([
58
{

apps/modernjs-ssr/host/src/routes/dynamic-remote/page.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ import React, { useState, Suspense } from 'react';
22
import {
33
loadRemote,
44
registerRemotes,
5-
createRemoteSSRComponent,
6-
} from '@modern-js/runtime/mf';
5+
kit,
6+
} from '@module-federation/modern-js/runtime';
7+
8+
const { createRemoteSSRComponent } = kit;
79

810
registerRemotes([
911
{

apps/modernjs-ssr/host/src/routes/remote/page.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import React, { useState, Suspense } from 'react';
22
import Comp from 'remote/Image';
3-
import { registerRemotes, loadRemote } from '@modern-js/runtime/mf';
3+
import {
4+
registerRemotes,
5+
loadRemote,
6+
} from '@module-federation/modern-js/runtime';
47

58
const NewRemoteCom = React.lazy(() =>
69
loadRemote('remote/Image').then((m) => {

apps/modernjs-ssr/nested-remote/src/routes/page.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
import { createRemoteSSRComponent } from '@modern-js/runtime/mf';
1+
import { kit } from '@module-federation/modern-js/runtime';
22

33
import Content from '../components/Content';
44
import './index.css';
55

6+
const { createRemoteSSRComponent } = kit;
7+
68
const RemoteSSRComponent = createRemoteSSRComponent({
79
loader: () => import('remote/Button'),
810
loading: 'loading...',

apps/modernjs/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @module-federation/modernjsapp
22

3+
## 0.1.94
4+
5+
### Patch Changes
6+
7+
- @module-federation/enhanced@0.13.1
8+
39
## 0.1.93
410

511
### Patch Changes

apps/modernjs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@module-federation/modernjsapp",
33
"private": true,
4-
"version": "0.1.93",
4+
"version": "0.1.94",
55
"scripts": {
66
"reset": "npx rimraf ./**/node_modules",
77
"dev": "modern dev",

apps/router-demo/router-remote5-2005/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# remote5
22

3+
## 1.1.1
4+
5+
### Patch Changes
6+
7+
- @module-federation/rsbuild-plugin@0.13.1
8+
- @module-federation/bridge-react@0.13.1
9+
310
## 1.1.0
411

512
### Minor Changes

apps/router-demo/router-remote5-2005/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "remote5",
33
"private": true,
4-
"version": "1.1.0",
4+
"version": "1.1.1",
55
"scripts": {
66
"dev": "rsbuild dev",
77
"build": "rsbuild build",

apps/website-new/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# website-new
22

3+
## 1.1.1
4+
5+
### Patch Changes
6+
7+
- @module-federation/error-codes@0.13.1
8+
39
## 1.1.0
410

511
### Minor Changes

apps/website-new/docs/en/configure/shared.mdx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ interface SharedConfig {
2020
requiredVersion?: string;
2121
eager?: boolean;
2222
shareScope?: string;
23+
import?: string | false;
2324
}
2425
```
2526

@@ -85,6 +86,16 @@ Under normal circumstances, you need to enable lazy entry, and then asynchronous
8586

8687
share scope name, default value is `'default'` .
8788

89+
## import
90+
91+
- Type: `string | false`
92+
- Required: No
93+
- Default: `undefined`
94+
95+
Control import path of shared dependencies, default value is `undefined` .
96+
97+
If set to `false`, this shared will not be packaged into the product, and only the `shared` provided by the consumer will be used. Therefore, please make sure that the consumer has provided the corresponding `shared` before setting.
98+
8899
## FAQ
89100

90101
### When to use shared dependencies

apps/website-new/docs/en/guide/framework/modernjs.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,11 @@ This function will also help inject the corresponding style tag/script while loa
112112

113113
```tsx
114114
import React, { FC, memo, useEffect } from 'react';
115-
import { registerRemotes, createRemoteSSRComponent } from '@modern-js/runtime/mf';
115+
import { registerRemotes, kit } from '@module-federation/modern-js/runtime';
116116
// The remote declared in the build plug-in can be imported directly at the top level
117117
import RemoteComp from 'remote/Image';
118118

119+
const { createRemoteSSRComponent } = kit;
119120

120121
const RemoteSSRComponent = createRemoteSSRComponent({
121122
// The remote declared in the build plug-in can also be loaded using this function: loader: () => import('remote/Image'),

apps/website-new/docs/en/practice/frameworks/modern/dynamic-remote.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,15 @@ export const loader = async ({ request }: LoaderFunctionArgs): Promise<DataLoade
147147
Consume loader data and dynamically load the corresponding producer:
148148

149149
```tsx
150-
import { createRemoteSSRComponent, loadRemote, registerRemotes } from '@modern-js/runtime/mf';
150+
import { kit, loadRemote, registerRemotes } from '@module-federation/modern-js/runtime';
151151
// Use import type to get data loader types
152152
import type { DataLoaderRes } from './page.data';
153153
import { useLoaderData } from '@modern-js/runtime/router';
154154

155155
import './index.css';
156156

157+
const { createRemoteSSRComponent } = kit;
158+
157159
const RemoteSSRComponent = createRemoteSSRComponent({
158160
loader: () => import('remote/Image'),
159161
loading: 'loading...',

apps/website-new/docs/en/practice/frameworks/modern/index.mdx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -217,12 +217,6 @@ export default defineConfig({
217217
```
218218
#### 3. Type hint
219219

220-
Add `/// <reference types='@module-federation/modern-js/types' />` to the `modern-app-env.d.ts` file to get the runtime `@modern-js/runtime/mf` type support.
221-
222-
```diff title='modern-app-env.d.ts'
223-
+ /// <reference types='@module-federation/modern-js/types' />
224-
```
225-
226220
Add `paths` in `tsconfig.json` to get the producer's type:
227221

228222
```json
@@ -260,9 +254,11 @@ This is because the producer's style files cannot be injected into the correspon
260254
This issue can be solved by using the [createremotessrcomponent](../../../guide/framework/modernjs#createremotessrcomponent) provided by `@module-federation/modern-js`.
261255

262256
```tsx title='page.tsx'
263-
import { createRemoteSSRComponent } from '@modern-js/runtime/mf'
257+
import { kit } from '@module-federation/modern-js/runtime'
264258
import './index.css';
265259

260+
const { createRemoteSSRComponent } = kit;
261+
266262
const RemoteSSRComponent = createRemoteSSRComponent({
267263
loader: () => import('remote/Image'),
268264
loading: 'loading...',

apps/website-new/docs/zh/configure/shared.mdx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ interface SharedConfig {
2020
requiredVersion?: string;
2121
eager?: boolean;
2222
shareScope?: string;
23+
import?: string | false;
2324
}
2425
```
2526

@@ -85,6 +86,16 @@ new ModuleFederationPlugin({
8586

8687
共享依赖作用域,默认值为 `'default'`
8788

89+
## import
90+
91+
- 类型:`string | false`
92+
- 是否必填:否
93+
- 默认值:`undefined`
94+
95+
共享依赖的导入路径,默认值为 `undefined`
96+
97+
若设置为 `false` ,则不会将此 shared 打包到产物中,仅使用消费者提供的 `shared`。 因此设置前请确认消费者已提供对应 `shared`
98+
8899
## FAQ
89100

90101
### 何时使用共享依赖

apps/website-new/docs/zh/guide/framework/modernjs.mdx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,6 @@ export default createModuleFederationConfig({
6565

6666
### 引用类型
6767

68-
`modern-app-env.d.ts` 文件增加 `/// <reference types='@module-federation/modern-js/types' />` 以获取运行时 `@@modern-js/runtime/mf` 类型支持。
69-
70-
```diff title='modern-app-env.d.ts'
71-
+ /// <reference types='@module-federation/modern-js/types' />
72-
```
73-
7468
`tsconfig.json` 添加 `paths` 以获取生产者的类型:
7569

7670
```json
@@ -124,10 +118,12 @@ type ComponentType = T[E] extends (...args: any) => any
124118

125119
```tsx
126120
import React, { FC, memo, useEffect } from 'react';
127-
import { registerRemotes, createRemoteSSRComponent } from '@modern-js/runtime/mf';
121+
import { registerRemotes, kit } from '@module-federation/modern-js/runtime';
128122
// 在构建插件声明过的 remote 可以直接在顶层 import
129123
import RemoteComp from 'remote/Image';
130124

125+
const { createRemoteSSRComponent } = kit;
126+
131127
const RemoteSSRComponent = createRemoteSSRComponent({
132128
// 在构建插件声明过的 remote 也可以使用此函数加载:loader: () => import('remote/Image'),
133129
loader: () => loadRemote('dynamic_remote/Image'),

apps/website-new/docs/zh/practice/frameworks/modern/dynamic-remote.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,15 @@ export const loader = async ({ request }: LoaderFunctionArgs): Promise<DataLoade
144144
消费 loader 数据,并动态加载对应的生产者:
145145

146146
```tsx
147-
import { createRemoteSSRComponent, loadRemote, registerRemotes } from '@modern-js/runtime/mf';
147+
import { kit, loadRemote, registerRemotes } from '@module-federation/modern-js/runtime';
148148
// 使用 import type ,仅获取类型
149149
import type { DataLoaderRes } from './page.data';
150150
import { useLoaderData } from '@modern-js/runtime/router';
151151

152152
import './index.css';
153153

154+
const { createRemoteSSRComponent } = kit;
155+
154156
const RemoteSSRComponent = createRemoteSSRComponent({
155157
loader: () => import('remote/Image'),
156158
loading: 'loading...',

apps/website-new/docs/zh/practice/frameworks/modern/index.mdx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -218,12 +218,6 @@ export default defineConfig({
218218
```
219219
#### 3. 引用类型
220220

221-
`modern-app-env.d.ts` 文件增加 `/// <reference types='@module-federation/modern-js/types' />` 以获取运行时 `@@modern-js/runtime/mf` 类型支持。
222-
223-
```diff title='modern-app-env.d.ts'
224-
+ /// <reference types='@module-federation/modern-js/types' />
225-
```
226-
227221
`tsconfig.json` 添加 `paths` 以获取生产者的类型:
228222

229223
```json
@@ -263,9 +257,11 @@ export default Index;
263257
修改消费者引用生产者处的代码(`src/routes/page.tsx`):
264258

265259
```tsx title='page.tsx'
266-
import { createRemoteSSRComponent } from '@modern-js/runtime/mf'
260+
import { kit } from '@module-federation/modern-js/runtime'
267261
import './index.css';
268262

263+
const { createRemoteSSRComponent } = kit;
264+
269265
const RemoteSSRComponent = createRemoteSSRComponent({
270266
loader: () => import('remote/Image'),
271267
loading: 'loading...',

apps/website-new/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "website-new",
3-
"version": "1.1.0",
3+
"version": "1.1.1",
44
"private": true,
55
"scripts": {
66
"dev": "rspress dev",

packages/bridge/bridge-react-webpack-plugin/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @module-federation/bridge-react-webpack-plugin
22

3+
## 0.13.1
4+
5+
### Patch Changes
6+
7+
- @module-federation/sdk@0.13.1
8+
39
## 0.13.0
410

511
### Patch Changes

packages/bridge/bridge-react-webpack-plugin/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@module-federation/bridge-react-webpack-plugin",
3-
"version": "0.13.0",
3+
"version": "0.13.1",
44
"publishConfig": {
55
"access": "public"
66
},

packages/bridge/bridge-react/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# @module-federation/bridge-react
22

3+
## 0.13.1
4+
5+
### Patch Changes
6+
7+
- @module-federation/sdk@0.13.1
8+
- @module-federation/bridge-shared@0.13.1
9+
310
## 0.13.0
411

512
### Minor Changes

packages/bridge/bridge-react/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@module-federation/bridge-react",
3-
"version": "0.13.0",
3+
"version": "0.13.1",
44
"publishConfig": {
55
"access": "public"
66
},

packages/bridge/bridge-shared/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# @module-federation/bridge-shared
22

3+
## 0.13.1
4+
35
## 0.13.0
46

57
### Patch Changes

packages/bridge/bridge-shared/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@module-federation/bridge-shared",
3-
"version": "0.13.0",
3+
"version": "0.13.1",
44
"publishConfig": {
55
"access": "public"
66
},

packages/bridge/bridge-shared/src/type.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ export interface ProviderParams {
22
moduleName?: string;
33
basename?: string;
44
memoryRoute?: { entryPath: string };
5+
hashRoute?: boolean;
56
style?: React.CSSProperties;
67
className?: string;
78
}

packages/bridge/vue3-bridge/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# @module-federation/bridge-vue3
22

3+
## 0.13.1
4+
5+
### Patch Changes
6+
7+
- @module-federation/runtime@0.13.1
8+
- @module-federation/sdk@0.13.1
9+
- @module-federation/bridge-shared@0.13.1
10+
311
## 0.13.0
412

513
### Patch Changes

0 commit comments

Comments
 (0)