-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
1,491 additions
and
1,015 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,33 @@ | ||
import RemoteApp from "@namespace/viteViteRemote"; | ||
import Mfapp01App from 'mfapp01/App'; | ||
import R from 'react'; | ||
import RD from 'react-dom/client'; | ||
import Remote2App from 'remote2/App'; | ||
import Button from 'remote3/button'; | ||
|
||
import { AgGridDemo } from 'viteViteRemote/AgGridDemo'; | ||
import App1 from 'viteViteRemote/App1'; | ||
import { App2 } from 'viteViteRemote/App2'; | ||
import { ref } from 'vue'; | ||
|
||
console.log('share vue', ref); | ||
console.log('share React', R, RD); | ||
|
||
export default function () { | ||
return ( | ||
<div> | ||
vite host | ||
<RemoteApp /> | ||
Vite React | ||
<h2>Button</h2> | ||
<Button /> | ||
<h2>Remote2App</h2> | ||
<Remote2App /> | ||
<h2>Mfapp01App</h2> | ||
<Mfapp01App /> | ||
<h2>Vite Remote App1</h2> | ||
<App1 /> | ||
<h2>Vite Remote App2</h2> | ||
<App2 /> | ||
<h2>Vite Remote AgGridDemo</h2> | ||
<AgGridDemo /> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import ReactDOM from 'react-dom/client'; | ||
import App from './App'; | ||
import './style.css'; | ||
|
||
//@ts-ignore | ||
const root = ReactDOM.createRoot(document.getElementById('app')); | ||
root.render( | ||
<React.StrictMode> | ||
<h1>MF HOST Demo</h1> | ||
<App /> | ||
</React.StrictMode> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,27 +9,32 @@ export default defineConfig({ | |
open: true, | ||
port: 5175, | ||
}, | ||
base: 'http://localhost:5175', | ||
// base: 'http://localhost:5175', | ||
plugins: [ | ||
react(), | ||
federation({ | ||
name: 'viteViteHost', | ||
remotes: { | ||
'@namespace/viteViteRemote': { | ||
entry: 'http://localhost:5176/remoteEntry.js', | ||
type: 'module', | ||
mfapp01: 'mfapp01@https://unpkg.com/[email protected]/dist/remoteEntry.js', | ||
remote2: 'mfapp02@https://unpkg.com/mf-app-02/dist/remoteEntry.js', | ||
remote3: | ||
'remote1@https://unpkg.com/[email protected]/dist/mf-manifest.json', | ||
'viteViteRemote': { | ||
'@namespace/viteViteRemote': { | ||
entry: 'http://localhost:5176/remoteEntry.js', | ||
type: 'module', | ||
}, | ||
}, | ||
}, | ||
filename: 'remoteEntry.js', | ||
shared: { | ||
vue: {}, | ||
react: { | ||
requiredVersion: '18', | ||
filename: 'remoteEntry.js', | ||
shared: { | ||
vue: {}, | ||
react: { | ||
requiredVersion: '18', | ||
}, | ||
'react-dom': {}, | ||
}, | ||
'react-dom': {}, | ||
}, | ||
runtimePlugins: ['./src/mfPlugins'], | ||
}), | ||
runtimePlugins: ['./src/mfPlugins'], | ||
}), | ||
// If you set build.target: "chrome89", you can remove this plugin | ||
false && topLevelAwait(), | ||
], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Vite + Vue</title> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
<script type="module" src="/src/main.jsx"></script> | ||
</body> | ||
</html> | ||
|
||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Vite React Remote</title> | ||
</head> | ||
|
||
<body> | ||
<div id="app"></div> | ||
<script type="module" src="/src/main.jsx"></script> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import 'ag-grid-community/styles/ag-grid.css'; | ||
import 'ag-grid-community/styles/ag-theme-alpine.css'; | ||
import { AgGridReact } from 'ag-grid-react'; | ||
import { useState } from 'react'; | ||
|
||
|
||
export const AgGridDemo = ({ }) => { | ||
const [rowData] = useState([ | ||
{ make: 'Toyota', model: 'Celica', price: 35000 }, | ||
{ make: 'Ford', model: 'Mondeo', price: 32000 }, | ||
{ make: 'Porsche', model: 'Boxter', price: 72000 }, | ||
]); | ||
|
||
const [columnDefs] = useState([{ field: 'make' }, { field: 'model' }, { field: 'price' }]); | ||
|
||
return ( | ||
<div className="App"> | ||
<div style={{ display: 'flex', flexDirection: 'row' }}> | ||
<div | ||
id="grid1" | ||
className="ag-theme-alpine" | ||
style={{ height: 400, width: 600, margin: '20px' }} | ||
> | ||
<AgGridReact rowData={rowData} columnDefs={columnDefs}></AgGridReact> | ||
</div> | ||
<div | ||
id="grid2" | ||
className="ag-theme-alpine" | ||
style={{ height: 400, width: 600, margin: '20px' }} | ||
> | ||
<AgGridReact rowData={rowData} columnDefs={columnDefs}></AgGridReact> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import React from 'react'; | ||
|
||
export default function () { | ||
return ( | ||
<div style={{ background: 'yellow', padding: 30 }}> | ||
Vite react App1 as default export via remote | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import "./app2.sass"; | ||
|
||
console.log("App2 shared React", React, ReactDOM) | ||
export function App2() { | ||
return ( | ||
<div class="container"> | ||
Vite react App2 as named export via remote with Sass use | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.container | ||
background-image: url(./assets/viteback.png) | ||
height: 200px | ||
color: orange |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,22 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import App from './App'; | ||
import { AgGridDemo } from './AgGridDemo'; | ||
import App1 from './App1'; | ||
import { App2 } from './App2'; | ||
|
||
//@ts-ignore | ||
const root = ReactDOM.createRoot(document.getElementById('app')); | ||
root.render( | ||
<React.StrictMode> | ||
<App /> | ||
<h1>MF Remote as standalone app</h1> | ||
|
||
<h2>App1</h2> | ||
<App1 /> | ||
|
||
<h2>App2</h2> | ||
<App2 /> | ||
|
||
<h2>AgGridDemo</h2> | ||
<AgGridDemo /> | ||
|
||
</React.StrictMode> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,19 +38,19 @@ | |
"homepage": "https://github.com/module-federation/vite#readme", | ||
"packageManager": "[email protected]", | ||
"dependencies": { | ||
"@module-federation/runtime": "^0.2.8", | ||
"@module-federation/runtime": "^0.3.5", | ||
"@rollup/pluginutils": "^5.1.0", | ||
"an-empty-js-file": "1.0.0", | ||
"estree-walker": "^2", | ||
"magic-string": "^0.30.10", | ||
"magic-string": "^0.30.11", | ||
"pathe": "^1.1.2" | ||
}, | ||
"devDependencies": { | ||
"husky": "^8.0.3", | ||
"microbundle": "^0.15.1", | ||
"mime-types": "^2.1.35", | ||
"pretty-quick": "^3.1.3", | ||
"rimraf": "^5.0.1", | ||
"vite": "^4.4.9" | ||
"pretty-quick": "^4.0.0", | ||
"rimraf": "^6.0.1", | ||
"vite": "^5.4.0" | ||
} | ||
} | ||
} |
Oops, something went wrong.