Skip to content

Commit 39ddca4

Browse files
Merge branch 'app-router-share-filter' into flight-plugins
# Conflicts: # pnpm-lock.yaml
2 parents 6a45a3a + 0133d01 commit 39ddca4

File tree

89 files changed

+3093
-3679
lines changed

Some content is hidden

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

89 files changed

+3093
-3679
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
- name: Build and test Packages
4949
run: |
5050
git fetch origin main
51-
npx nx run-many --targets=build --projects=tag:type:pkg
51+
npx nx run-many --targets=build --projects=tag:type:pkg --skip-nx-cache
5252
ls -l packages/*/dist packages/*/package.json
5353
5454
- name: Release

apps/manifest-demo/webpack-host/runtimePlugin.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,13 @@ export default function (): FederationRuntimePlugin {
1212

1313
return args;
1414
},
15+
createLink({ url }) {
16+
const link = document.createElement('link');
17+
link.setAttribute('href', url);
18+
link.setAttribute('rel', 'preload');
19+
link.setAttribute('as', 'script');
20+
link.setAttribute('crossorigin', 'anonymous');
21+
return link;
22+
},
1523
};
1624
}

apps/modernjs-ssr/dynamic-nested-remote/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@
2626
],
2727
"dependencies": {
2828
"@babel/runtime": "7.26.0",
29-
"@modern-js/runtime": "2.65.1",
29+
"@modern-js/runtime": "2.67.6",
3030
"@module-federation/modern-js": "workspace:*",
3131
"antd": "4.24.15",
3232
"react": "~18.3.1",
3333
"react-dom": "~18.3.1"
3434
},
3535
"devDependencies": {
3636
"@modern-js-app/eslint-config": "2.59.0",
37-
"@modern-js/app-tools": "2.65.1",
37+
"@modern-js/app-tools": "2.67.6",
3838
"@modern-js/eslint-config": "2.59.0",
39-
"@modern-js/tsconfig": "2.65.1",
39+
"@modern-js/tsconfig": "2.67.6",
4040
"@types/jest": "~29.5.0",
4141
"@types/node": "~16.11.7",
4242
"@types/react": "~18.2.0",

apps/modernjs-ssr/dynamic-remote-new-version/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@
2626
],
2727
"dependencies": {
2828
"@babel/runtime": "7.26.0",
29-
"@modern-js/runtime": "2.65.1",
29+
"@modern-js/runtime": "2.67.6",
3030
"@module-federation/modern-js": "workspace:*",
3131
"antd": "4.24.15",
3232
"react": "~18.3.1",
3333
"react-dom": "~18.3.1"
3434
},
3535
"devDependencies": {
3636
"@modern-js-app/eslint-config": "2.59.0",
37-
"@modern-js/app-tools": "2.65.1",
37+
"@modern-js/app-tools": "2.67.6",
3838
"@modern-js/eslint-config": "2.59.0",
39-
"@modern-js/tsconfig": "2.65.1",
39+
"@modern-js/tsconfig": "2.67.6",
4040
"@types/jest": "~29.5.0",
4141
"@types/node": "~16.11.7",
4242
"@types/react": "~18.2.0",

apps/modernjs-ssr/dynamic-remote/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@
2626
],
2727
"dependencies": {
2828
"@babel/runtime": "7.26.0",
29-
"@modern-js/runtime": "2.65.1",
29+
"@modern-js/runtime": "2.67.6",
3030
"@module-federation/modern-js": "workspace:*",
3131
"antd": "4.24.15",
3232
"react": "~18.3.1",
3333
"react-dom": "~18.3.1"
3434
},
3535
"devDependencies": {
3636
"@modern-js-app/eslint-config": "2.59.0",
37-
"@modern-js/app-tools": "2.65.1",
37+
"@modern-js/app-tools": "2.67.6",
3838
"@modern-js/eslint-config": "2.59.0",
39-
"@modern-js/tsconfig": "2.65.1",
39+
"@modern-js/tsconfig": "2.67.6",
4040
"@types/jest": "~29.5.0",
4141
"@types/node": "~16.11.7",
4242
"@types/react": "~18.2.0",

apps/modernjs-ssr/host/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@
2626
],
2727
"dependencies": {
2828
"@babel/runtime": "7.26.0",
29-
"@modern-js/runtime": "2.65.1",
29+
"@modern-js/runtime": "2.67.6",
3030
"@module-federation/modern-js": "workspace:*",
3131
"antd": "4.24.15",
3232
"react": "~18.3.1",
3333
"react-dom": "~18.3.1"
3434
},
3535
"devDependencies": {
3636
"@modern-js-app/eslint-config": "2.59.0",
37-
"@modern-js/app-tools": "2.65.1",
37+
"@modern-js/app-tools": "2.67.6",
3838
"@modern-js/eslint-config": "2.59.0",
39-
"@modern-js/tsconfig": "2.65.1",
39+
"@modern-js/tsconfig": "2.67.6",
4040
"@types/jest": "~29.5.0",
4141
"@types/node": "~16.11.7",
4242
"@types/react": "~18.2.0",

apps/modernjs-ssr/nested-remote/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@
2626
],
2727
"dependencies": {
2828
"@babel/runtime": "7.26.0",
29-
"@modern-js/runtime": "2.65.1",
29+
"@modern-js/runtime": "2.67.6",
3030
"@module-federation/modern-js": "workspace:*",
3131
"antd": "4.24.15",
3232
"react": "~18.3.1",
3333
"react-dom": "~18.3.1"
3434
},
3535
"devDependencies": {
3636
"@modern-js-app/eslint-config": "2.59.0",
37-
"@modern-js/app-tools": "2.65.1",
37+
"@modern-js/app-tools": "2.67.6",
3838
"@modern-js/eslint-config": "2.59.0",
39-
"@modern-js/tsconfig": "2.65.1",
39+
"@modern-js/tsconfig": "2.67.6",
4040
"@types/jest": "~29.5.0",
4141
"@types/node": "~16.11.7",
4242
"@types/react": "~18.2.0",

apps/modernjs-ssr/remote-new-version/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@
2626
],
2727
"dependencies": {
2828
"@babel/runtime": "7.26.0",
29-
"@modern-js/runtime": "2.65.1",
29+
"@modern-js/runtime": "2.67.6",
3030
"@module-federation/modern-js": "workspace:*",
3131
"antd": "4.24.15",
3232
"react": "~18.3.1",
3333
"react-dom": "~18.3.1"
3434
},
3535
"devDependencies": {
3636
"@modern-js-app/eslint-config": "2.59.0",
37-
"@modern-js/app-tools": "2.65.1",
37+
"@modern-js/app-tools": "2.67.6",
3838
"@modern-js/eslint-config": "2.59.0",
39-
"@modern-js/tsconfig": "2.65.1",
39+
"@modern-js/tsconfig": "2.67.6",
4040
"@types/jest": "~29.5.0",
4141
"@types/node": "~16.11.7",
4242
"@types/react": "~18.2.0",

apps/modernjs-ssr/remote/modern.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ export default defineConfig({
66
dev: {
77
port: 3051,
88
},
9+
output: {
10+
assetPrefix: 'http://localhost:8080',
11+
},
912
runtime: {
1013
router: true,
1114
},

apps/modernjs-ssr/remote/module-federation.config.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import { createModuleFederationConfig } from '@module-federation/modern-js';
22
export default createModuleFederationConfig({
33
name: 'remote',
4-
filename: 'remoteEntry.js',
4+
manifest: {
5+
filePath: 'static',
6+
},
7+
filename: 'static/remoteEntry.js',
58
exposes: {
69
'./Image': './src/components/Image.tsx',
710
'./Button': './src/components/Button.tsx',

apps/modernjs-ssr/remote/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@
2626
],
2727
"dependencies": {
2828
"@babel/runtime": "7.26.0",
29-
"@modern-js/runtime": "2.65.1",
29+
"@modern-js/runtime": "2.67.6",
3030
"@module-federation/modern-js": "workspace:*",
3131
"antd": "4.24.15",
3232
"react": "~18.3.1",
3333
"react-dom": "~18.3.1"
3434
},
3535
"devDependencies": {
3636
"@modern-js-app/eslint-config": "2.59.0",
37-
"@modern-js/app-tools": "2.65.1",
37+
"@modern-js/app-tools": "2.67.6",
3838
"@modern-js/eslint-config": "2.59.0",
39-
"@modern-js/tsconfig": "2.65.1",
39+
"@modern-js/tsconfig": "2.67.6",
4040
"@types/jest": "~29.5.0",
4141
"@types/node": "~16.11.7",
4242
"@types/react": "~18.2.0",

apps/modernjs/CHANGELOG.md

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

3+
## 0.1.98
4+
5+
### Patch Changes
6+
7+
- @module-federation/enhanced@0.14.3
8+
9+
## 0.1.97
10+
11+
### Patch Changes
12+
13+
- @module-federation/enhanced@0.14.2
14+
15+
## 0.1.96
16+
17+
### Patch Changes
18+
19+
- 0c68c2f: feat(modern-js-plugin): add server plugin to handle remote's SSR assets
20+
- @module-federation/enhanced@0.14.1
21+
322
## 0.1.95
423

524
### Patch Changes

apps/modernjs/package.json

Lines changed: 4 additions & 4 deletions
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.95",
4+
"version": "0.1.98",
55
"scripts": {
66
"reset": "npx rimraf ./**/node_modules",
77
"dev": "modern dev",
@@ -26,16 +26,16 @@
2626
],
2727
"dependencies": {
2828
"@babel/runtime": "7.26.0",
29-
"@modern-js/runtime": "2.65.1",
29+
"@modern-js/runtime": "2.67.6",
3030
"@module-federation/enhanced": "workspace:*",
3131
"react": "18.3.1",
3232
"react-dom": "18.3.1"
3333
},
3434
"devDependencies": {
3535
"@modern-js-app/eslint-config": "2.59.0",
36-
"@modern-js/app-tools": "2.65.1",
36+
"@modern-js/app-tools": "2.67.6",
3737
"@modern-js/eslint-config": "2.59.0",
38-
"@modern-js/tsconfig": "2.65.1",
38+
"@modern-js/tsconfig": "2.67.6",
3939
"@types/jest": "~29.5.0",
4040
"@types/node": "~20.12.12",
4141
"@types/react": "~18.2.0",

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

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

3+
## 1.1.5
4+
5+
### Patch Changes
6+
7+
- @module-federation/bridge-react@0.14.3
8+
- @module-federation/rsbuild-plugin@0.14.3
9+
10+
## 1.1.4
11+
12+
### Patch Changes
13+
14+
- @module-federation/bridge-react@0.14.2
15+
- @module-federation/rsbuild-plugin@0.14.2
16+
17+
## 1.1.3
18+
19+
### Patch Changes
20+
21+
- @module-federation/rsbuild-plugin@0.14.1
22+
- @module-federation/bridge-react@0.14.1
23+
324
## 1.1.2
425

526
### Patch 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.2",
4+
"version": "1.1.5",
55
"scripts": {
66
"dev": "rsbuild dev",
77
"build": "rsbuild build",

apps/website-new/CHANGELOG.md

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

3+
## 1.1.5
4+
5+
### Patch Changes
6+
7+
- @module-federation/error-codes@0.14.3
8+
9+
## 1.1.4
10+
11+
### Patch Changes
12+
13+
- @module-federation/error-codes@0.14.2
14+
15+
## 1.1.3
16+
17+
### Patch Changes
18+
19+
- @module-federation/error-codes@0.14.1
20+
321
## 1.1.2
422

523
### Patch Changes

apps/website-new/docs/en/guide/troubleshooting/other.mdx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,33 @@ When `exposes` is set in the project, it will be regarded as a producer. To ensu
9090
* [Modern.js]: Set [devServer.headers](https://modernjs.dev/configure/app/tools/dev-server.html#headers) value to the specified domain whitelist instead of `*`
9191

9292
* [Rsbuild]: Set [server.cors.origin](https://rsbuild.dev/config/server/cors#origin) value to the specified domain whitelist instead of `*`
93+
94+
## A preload for 'http://resource-url' is found, but is not used because the request credentials mode does not match. Consider taking a look at crossorigin attribute.
95+
96+
### Reason
97+
98+
When the producer URL is a manifest, loading this producer module will automatically preload the corresponding resources. If the above warning occurs, it is because the default preload does not configure credentials, while the actual `load remote script` carries the corresponding credentials, causing the preload to fail.
99+
100+
### Solution
101+
102+
Add a runtime plugin via [runtimePlugins](../../configure/runtimeplugins) and configure the `crossorigin` attribute in the [createLink](../../plugin/dev/index#createlink) hook. Its value needs to be consistent with the actual `load script`.
103+
104+
For example, to modify the crossorigin attribute of the preloaded link to `anonymous`:
105+
106+
```ts title="runtimePlugin.ts
107+
import { FederationRuntimePlugin } from '@module-federation/runtime/types';
108+
109+
export default function MFLinkPlugin(): FederationRuntimePlugin {
110+
return {
111+
name: 'link-plugin',
112+
createLink({ url }) {
113+
const link = document.createElement('link');
114+
link.setAttribute('href', url);
115+
link.setAttribute('rel', 'preload');
116+
link.setAttribute('as', 'script');
117+
link.setAttribute('crossorigin', 'anonymous');
118+
return link
119+
}
120+
};
121+
}
122+
```

apps/website-new/docs/en/plugin/dev/index.mdx

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,42 @@ const changeScriptAttributePlugin: () => FederationRuntimePlugin = function () {
534534
};
535535
```
536536

537+
538+
### createLink
539+
540+
`SyncHook`
541+
542+
- **Type**
543+
544+
```typescript
545+
function createLink(args: CreateLinkOptions): HTMLLinkElement | void;
546+
547+
type CreateScriptOptions = {
548+
url: string;
549+
attrs?: Record<string, any>;
550+
};
551+
```
552+
553+
- Example
554+
555+
```typescript
556+
import { init } from '@module-federation/enhanced/runtime';
557+
import type { FederationRuntimePlugin } from '@module-federation/enhanced/runtime';
558+
559+
const changeLinkAttributePlugin: () => FederationRuntimePlugin = function () {
560+
return {
561+
name: 'change-link-attribute',
562+
createLink({ url }) {
563+
link.setAttribute('href', url);
564+
link.setAttribute('rel', 'preload');
565+
link.setAttribute('as', 'script');
566+
link.setAttribute('crossorigin', 'anonymous');
567+
return link;
568+
},
569+
};
570+
};
571+
```
572+
537573
### fetch
538574
The `fetch` function allows customizing the request that fetches the manifest JSON. A successful `Response` must yield a valid JSON.
539575

0 commit comments

Comments
 (0)