Skip to content

Commit a93f5d5

Browse files
author
张洪恩
committed
test same remote
1 parent 0fea90f commit a93f5d5

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

react-manifest-example/host/rsbuild.config.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@ import { ModuleFederationPlugin } from '@module-federation/enhanced/rspack';
44

55
export default defineConfig({
66
server: {
7-
port: 3000,
7+
port: 3009,
88
},
99
tools: {
1010
rspack: (config, { appendPlugins }) => {
1111
appendPlugins([
1212
new ModuleFederationPlugin({
1313
name: 'host',
1414
remotes: {
15-
remote1: 'remote1@http://localhost:3001/mf-manifest.json',
15+
mfapp01: "mfapp01@https://unpkg.com/mf-app-01@1.0.9/dist/remoteEntry.js",
16+
remote1: 'remote1@http://localhost:3001/manifestpath/mf-manifest.json',
1617
remote2: 'remote2@http://localhost:3002/mf-manifest.json',
1718
},
1819
shared: ['react', 'react-dom'],

react-manifest-example/host/src/bootstrap.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import React from 'react';
22
import ReactDOM from 'react-dom/client';
33
import App from './App';
4+
import aA from "mfapp01/App"
5+
console.log(222, aA)
46

57
const root = ReactDOM.createRoot(document.getElementById('root')!);
68
root.render(

react-manifest-example/remote1/rsbuild.config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ export default defineConfig({
1616
appendPlugins([
1717
new ModuleFederationPlugin({
1818
name: 'remote1',
19+
remotes: {
20+
bbc: "http://localhost:5173/dd/remoteEntry.js",
21+
},
22+
remoteType: "module",
1923
exposes: {
2024
'./button': './src/button.tsx',
2125
'./app': './src/app.tsx',
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import bbc from "bbc/App"
2+
console.log(123, bbc)
3+
14
export default function Button() {
25
return <div>remote2</div>;
36
}

0 commit comments

Comments
 (0)