Skip to content

Commit 3070e26

Browse files
authored
feat: support interface data prefetch (#2543)
1 parent 13975e1 commit 3070e26

Some content is hidden

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

68 files changed

+26661
-20727
lines changed

.changeset/light-items-battle.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@module-federation/data-prefetch': patch
3+
---
4+
5+
feat(@module-federation/data-prefetch): support data prefetch in Module Federation

.github/workflows/e2e-manifest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,4 @@ jobs:
4343

4444
- name: E2E Test for Manifest Demo
4545
if: steps.check-ci.outcome == 'success'
46-
run: pnpm run app:manifest:dev & echo "done" && npx wait-on tcp:3009 && npx wait-on tcp:3012 && npx nx run-many --target=e2e --projects=manifest-webpack-host --parallel=1 && npx kill-port 3013 3009 3010 3011 3012
46+
run: pnpm run app:manifest:dev & echo "done" && npx wait-on tcp:3009 && npx wait-on tcp:3012 && npx wait-on http://127.0.0.1:4001/ && npx nx run-many --target=e2e --projects=manifest-webpack-host --parallel=1 && npx kill-port 3013 3009 3010 3011 3012 4001

apps/manifest-demo/3009-webpack-provider/tsconfig.app.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
{
2-
"extends": "./tsconfig.json",
2+
"extends": "../../../tsconfig.base.json",
33
"compilerOptions": {
4+
"jsx": "react-jsx",
5+
"allowJs": true,
6+
"esModuleInterop": true,
7+
"allowSyntheticDefaultImports": true,
8+
"forceConsistentCasingInFileNames": true,
9+
"strict": true,
10+
"noImplicitOverride": true,
11+
"noPropertyAccessFromIndexSignature": true,
12+
"noImplicitReturns": true,
13+
"noFallthroughCasesInSwitch": true,
414
"outDir": "../../../dist/out-tsc",
515
"types": [
616
"node",

apps/manifest-demo/3009-webpack-provider/tsconfig.json

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,29 @@
1010
"noImplicitOverride": true,
1111
"noPropertyAccessFromIndexSignature": true,
1212
"noImplicitReturns": true,
13-
"noFallthroughCasesInSwitch": true
13+
"noFallthroughCasesInSwitch": true,
14+
"outDir": "../../../dist/out-tsc",
15+
"types": [
16+
"node",
17+
"@nx/react/typings/cssmodule.d.ts",
18+
"@nx/react/typings/image.d.ts"
19+
]
1420
},
15-
"files": [],
16-
"references": [
17-
{
18-
"path": "./tsconfig.app.json"
19-
}
20-
]
21+
"files": [
22+
"../../../node_modules/@nx/react/typings/cssmodule.d.ts",
23+
"../../../node_modules/@nx/react/typings/image.d.ts"
24+
],
25+
"exclude": [
26+
"jest.config.ts",
27+
"**/*.spec.ts",
28+
"**/*.test.ts",
29+
"**/*.spec.tsx",
30+
"**/*.test.tsx",
31+
"**/*.spec.js",
32+
"**/*.test.js",
33+
"**/*.spec.jsx",
34+
"**/*.test.jsx",
35+
"dist/**"
36+
],
37+
"include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"]
2138
}

apps/manifest-demo/3010-rspack-provider/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"@rspack/plugin-react-refresh": "0.5.9"
1010
},
1111
"dependencies": {
12-
"antd": "4.24.15"
12+
"antd": "4.24.15",
13+
"react-router-dom": "^6.23.1"
1314
}
1415
}

apps/manifest-demo/3010-rspack-provider/rspack.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ module.exports = composePlugins(
6666
'react-dom': {},
6767
'react-dom/': {},
6868
},
69+
dataPrefetch: true,
6970
}),
7071
);
7172
(config.devServer = {

apps/manifest-demo/3010-rspack-provider/src/App.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import LocalButton from './Button';
2+
import { Await } from 'react-router-dom';
3+
console.log(Await);
24

35
const App = () => (
46
<div>

apps/manifest-demo/webpack-host/src/App.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import React, { Suspense, lazy } from 'react';
2+
// @ts-ignore
3+
import ReactComponent from 'modern-js-provider/react-component';
24
import TestRemoteHook from './test-remote-hook';
35
import { loadRemote } from '@module-federation/runtime';
46
import LocalBtn from './components/ButtonOldAnt';
@@ -29,6 +31,7 @@ const WebpackPngRemote = lazy(() => import('remote1/WebpackPng'));
2931

3032
const App = () => (
3133
<div>
34+
<ReactComponent />
3235
<h2>Manifest Basic Usage</h2>
3336
<h3>check static remote</h3>
3437
<table border={1} cellPadding={5}>

apps/manifest-demo/webpack-host/webpack.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ module.exports = composePlugins(withNx(), withReact(), (config, context) => {
2020
'rspack_manifest_provider@http://localhost:3011/mf-manifest.json',
2121
'js-entry-provider':
2222
'rspack_js_entry_provider@http://localhost:3012/remoteEntry.js',
23+
'modern-js-provider': 'app1@http://127.0.0.1:4001/mf-manifest.json',
2324
},
2425
filename: 'remoteEntry.js',
2526
exposes: {

apps/modernjs/cypress/e2e/app.cy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ describe('modernjs/', () => {
33

44
describe('Welcome message', () => {
55
it('should display welcome message', () => {
6-
cy.get('.title').contains('Welcome');
6+
cy.get('.container-box').contains('Resend request with parameters');
77
});
88
});
99
});

0 commit comments

Comments
 (0)