Skip to content

Commit 09285b5

Browse files
debug alternative remote devtools (#3836)
* debug alternative remote devtools * update rspack * fix single runtime for rspack * fix single runtime for rspack --------- Co-authored-by: ScriptedAlchemy <[email protected]>
1 parent 460932a commit 09285b5

File tree

22 files changed

+57671
-69138
lines changed

22 files changed

+57671
-69138
lines changed

angular14-react/pnpm-lock.yaml

Lines changed: 4874 additions & 6918 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-lock.yaml

Lines changed: 39303 additions & 45579 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ packages:
1111
- '!nextjs-dynamic-ssr/*'
1212
- '!cra-react-app-rewired/*'
1313
- '!runtime-plugins/remote-router'
14-
- '!react-manifest-example'
14+
- '!react-manifest-example/*'
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
/// <reference types="react" />
21
import './App.css';
32
declare const App: (info?: {
43
abc?: string;
5-
}) => JSX.Element;
4+
}) => import("react/jsx-runtime").JSX.Element;
65
export default App;
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
/// <reference types="react" />
2-
export default function Button(): JSX.Element;
1+
export default function Button(): import("react/jsx-runtime").JSX.Element;
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
/// <reference types="react" />
2-
export default function Button(): JSX.Element;
1+
export default function Button(): import("react/jsx-runtime").JSX.Element;

react-manifest-example/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"private": true,
55
"version": "0.0.0",
66
"scripts": {
7-
"start": "pnpm run --filter react-manifest-example_* --parallel dev",
7+
"preinstall": "find . -name \"noexist\" -type d -prune -exec rm -rf '{}' +; pnpm install --ignore-scripts",
8+
"start": "pnpm run --filter react-manifest-example_** --parallel dev",
89
"build": "pnpm run --filter react-manifest-example_* build",
910
"serve": "pnpm run --filter react-manifest-example_* --parallel serve",
1011
"clean": "pnpm run --filter react-manifest-example_* --parallel clean"

react-manifest-example/pnpm-lock.yaml

Lines changed: 1483 additions & 2076 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

react-manifest-example/pnpm-workspace.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ packages:
22
- host
33
- remote1
44
- remote2
5-
5+
- remote2_alternative
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Rsbuild Project
2+
3+
## Setup
4+
5+
Install the dependencies:
6+
7+
```bash
8+
pnpm install
9+
```
10+
11+
## Get Started
12+
13+
Start the dev server:
14+
15+
```bash
16+
pnpm dev
17+
```
18+
19+
Build the app for production:
20+
21+
```bash
22+
pnpm build
23+
```
24+
25+
Preview the production build locally:
26+
27+
```bash
28+
pnpm preview
29+
```
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "react-manifest-example_remote2_alternative",
3+
"private": true,
4+
"version": "1.0.0",
5+
"scripts": {
6+
"dev": "rsbuild dev",
7+
"build": "rsbuild build",
8+
"preview": "rsbuild preview"
9+
},
10+
"dependencies": {
11+
"@module-federation/enhanced": "^0.1.12",
12+
"antd": "^5.16.2",
13+
"react": "^18.2.0",
14+
"react-dom": "^18.2.0",
15+
"react-router-dom": "^6.22.3"
16+
},
17+
"devDependencies": {
18+
"@rsbuild/core": "^0.6.3",
19+
"@rsbuild/plugin-react": "^0.6.3",
20+
"@types/react": "^18.2.79",
21+
"@types/react-dom": "^18.2.25",
22+
"typescript": "^5.4.5"
23+
}
24+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { defineConfig } from '@rsbuild/core';
2+
import { pluginReact } from '@rsbuild/plugin-react';
3+
import { ModuleFederationPlugin } from '@module-federation/enhanced/rspack';
4+
5+
export default defineConfig({
6+
server: {
7+
port: 3003,
8+
},
9+
dev: {
10+
// It is necessary to configure assetPrefix, and in the production environment, you need to configure output.assetPrefix
11+
assetPrefix: 'http://localhost:3003',
12+
},
13+
tools: {
14+
rspack: (config, { appendPlugins }) => {
15+
config.output!.uniqueName = 'app2a';
16+
appendPlugins([
17+
new ModuleFederationPlugin({
18+
name: 'remote2',
19+
exposes: {
20+
'./button': './src/button.tsx',
21+
},
22+
shared: ['react', 'react-dom'],
23+
}),
24+
]);
25+
},
26+
},
27+
plugins: [pluginReact()],
28+
});
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/* body {
2+
margin: 0;
3+
color: #fff;
4+
font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
5+
background-image: linear-gradient(to bottom, #020917, #101725);
6+
} */
7+
8+
9+
.content {
10+
display: flex;
11+
min-height: 100vh;
12+
line-height: 1.1;
13+
text-align: center;
14+
flex-direction: column;
15+
justify-content: center;
16+
}
17+
18+
.content h1 {
19+
font-size: 3.6rem;
20+
font-weight: 700;
21+
}
22+
23+
.content p {
24+
font-size: 1.2rem;
25+
font-weight: 400;
26+
opacity: 0.5;
27+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import React from 'react';
2+
import { BrowserRouter, Routes, Route, MemoryRouter, Link } from 'react-router-dom';
3+
import './App.css';
4+
import { Image } from 'antd';
5+
6+
function Home(){
7+
return <div>hello sub2 home page</div>
8+
}
9+
10+
function Detail(){
11+
return <>
12+
<div>hello sub2 detail page</div>
13+
<Image
14+
width={200}
15+
src="https://gw.alipayobjects.com/zos/antfincdn/LlvErxo8H9/photo-1503185912284-5271ff81b9a8.webp"
16+
/>
17+
</>
18+
}
19+
20+
const App = (info: {abc?: number}) => {
21+
return (
22+
<>
23+
<ul>
24+
<li>
25+
<Link to="/">Home</Link>
26+
</li>
27+
<li>
28+
<Link to="/detail">Detail</Link>
29+
</li>
30+
</ul>
31+
<Routes>
32+
<Route path="/" Component={Home}/>
33+
<Route path="/detail" Component={Detail}/>
34+
</Routes>
35+
</>
36+
);
37+
};
38+
39+
export default App;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import React from 'react';
2+
import ReactDOM from 'react-dom/client';
3+
import App from './App';
4+
5+
//@ts-ignore
6+
const root = ReactDOM.createRoot(document.getElementById('root')!);
7+
root.render(
8+
<React.StrictMode>
9+
<App basename={'/remote2'}/>
10+
</React.StrictMode>,
11+
);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default function Button() {
2+
return <div style={{background: 'red'}}>Button from elsewhere</div>;
3+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference types="@rsbuild/core/types" />
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import('./bootstrap');
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"compilerOptions": {
3+
"baseUrl": "./",
4+
"target": "ES2020",
5+
"lib": ["DOM", "ES2020"],
6+
"module": "ESNext",
7+
"jsx": "react-jsx",
8+
"strict": true,
9+
"skipLibCheck": true,
10+
"isolatedModules": true,
11+
"resolveJsonModule": true,
12+
"moduleResolution": "bundler",
13+
"useDefineForClassFields": true
14+
},
15+
"include": ["src"]
16+
}

0 commit comments

Comments
 (0)