Skip to content

chore: general housekeeping #3952

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 38 commits into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
3f93c24
chore: general housekeeping
ScriptedAlchemy May 20, 2024
5b1d610
chore: general housekeeping
ScriptedAlchemy May 20, 2024
f5c0365
chore: general housekeeping
ScriptedAlchemy May 20, 2024
d77917d
chore: general housekeeping
ScriptedAlchemy May 20, 2024
386a997
chore: general housekeeping
ScriptedAlchemy May 20, 2024
367fde2
chore: general housekeeping
ScriptedAlchemy May 20, 2024
a7104ac
chore: general housekeeping
ScriptedAlchemy May 20, 2024
bc83f7f
chore: general housekeeping
ScriptedAlchemy May 20, 2024
5b49948
chore: general housekeeping
ScriptedAlchemy May 20, 2024
18f99a6
Merge branch 'refs/heads/master' into housekeeping
ScriptedAlchemy May 20, 2024
25b96fb
chore: general housekeeping
ScriptedAlchemy May 20, 2024
5d12a5f
chore: general housekeeping
ScriptedAlchemy May 21, 2024
96ad806
chore: general housekeeping
ScriptedAlchemy May 21, 2024
1cae044
chore: general housekeeping
ScriptedAlchemy May 21, 2024
e1508a4
Merge branch 'refs/heads/master' into housekeeping
ScriptedAlchemy May 21, 2024
ff2810f
chore: general housekeeping
ScriptedAlchemy May 21, 2024
2335308
Merge branch 'refs/heads/master' into housekeeping
ScriptedAlchemy May 21, 2024
c2f5ba0
chore: general housekeeping
ScriptedAlchemy May 21, 2024
8d4efc6
chore: general housekeeping
ScriptedAlchemy May 21, 2024
0e37372
chore: general housekeeping
ScriptedAlchemy May 21, 2024
c344291
chore: general housekeeping
ScriptedAlchemy May 21, 2024
138f590
chore: general housekeeping
ScriptedAlchemy May 21, 2024
cff4d70
chore: general housekeeping
ScriptedAlchemy May 21, 2024
fb70312
chore: general housekeeping
ScriptedAlchemy May 21, 2024
4a1efbf
Merge branch 'refs/heads/master' into housekeeping
ScriptedAlchemy May 30, 2024
53cb976
ll
ScriptedAlchemy May 30, 2024
77adeaf
chore: general housekeeping
ScriptedAlchemy Jun 2, 2024
6faba5c
Merge branch 'refs/heads/master' into housekeeping
ScriptedAlchemy Jun 3, 2024
39b1fdd
chore: general housekeeping
ScriptedAlchemy Jun 3, 2024
68d1724
Merge branch 'refs/heads/master' into housekeeping
ScriptedAlchemy Jun 3, 2024
89bf76e
Merge branch 'refs/heads/master' into housekeeping
ScriptedAlchemy Jun 3, 2024
7a42dde
Merge branch 'refs/heads/master' into housekeeping
ScriptedAlchemy Jun 3, 2024
96aad6d
hk
ScriptedAlchemy Jun 3, 2024
b828c3e
Merge branch 'refs/heads/master' into housekeeping
ScriptedAlchemy Jun 6, 2024
44a3e95
Merge branch 'refs/heads/master' into housekeeping
ScriptedAlchemy Jun 8, 2024
9f349e3
fix single runtime for rspack
ScriptedAlchemy Jun 8, 2024
b717fc0
Merge branch 'refs/heads/master' into housekeeping
ScriptedAlchemy Jun 10, 2024
98bd943
fix single runtime for rspack
ScriptedAlchemy Jun 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions bi-directional/app1/modern.config.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
import appTools, { defineConfig } from '@modern-js/app-tools';

import {ModuleFederationPlugin} from '@module-federation/enhanced/webpack'
// https://modernjs.dev/en/configure/app/usage
export default defineConfig({
server: {
port: 3001,
},
// dev: {
// // set publicPath
// assetPrefix: 'http://localhost:3001/',
// },
runtime: {
router: true,
},
source: {
// automatically generated asynchronous boundary via Dynamic Import, allowing the page code to consume remote modules generated by the module federation.
enableAsyncEntry: true,
enableAsyncEntry: true, // Enable async entry for module federation
},
tools: {
webpack: (config, { webpack, appendPlugins }) => {
// Remove splitChunks optimization
delete config.optimization.splitChunks;
config.output.publicPath = 'auto';

// Add Module Federation Plugin
appendPlugins([
new webpack.container.ModuleFederationPlugin({
new ModuleFederationPlugin({
name: 'app1',
runtime: false,
filename: 'static/js/remoteEntry.js',
Expand Down
1 change: 1 addition & 0 deletions bi-directional/app1/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"@modern-js/eslint-config": "2.50.0",
"@modern-js/tsconfig": "2.50.0",
"@modern-js-app/eslint-config": "2.50.0",
"@module-federation/enhanced": "0.1.13",
"@modern-js/builder-rspack-provider": "2.46.1",
"lint-staged": "15.0.2",
"prettier": "3.0.3",
Expand Down
4 changes: 1 addition & 3 deletions bi-directional/app1/src/routes/page.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ const Index = () => (
<p className="description">
FEDERATED: <Button />
</p>
<p className="description">
go to http://localhost:3002
</p>
<p className="description">go to http://localhost:3002</p>

<div className="grid">
<a
Expand Down
3 changes: 2 additions & 1 deletion bi-directional/app2/modern.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import appTools, { defineConfig } from '@modern-js/app-tools';
import { ModuleFederationPlugin } from '@module-federation/enhanced/webpack';

// https://modernjs.dev/en/configure/app/usage
export default defineConfig({
Expand All @@ -22,7 +23,7 @@ export default defineConfig({
config.output.publicPath = 'auto';

appendPlugins([
new webpack.container.ModuleFederationPlugin({
new ModuleFederationPlugin({
name: 'app2',
runtime: false,
filename: 'static/js/remoteEntry.js',
Expand Down
1 change: 1 addition & 0 deletions bi-directional/app2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"@modern-js/tsconfig": "2.50.0",
"@modern-js-app/eslint-config": "2.50.0",
"@modern-js/builder-rspack-provider": "2.46.1",
"@module-federation/enhanced": "0.1.13",
"lint-staged": "15.0.2",
"prettier": "3.0.3",
"husky": "8.0.3",
Expand Down
11,954 changes: 4,622 additions & 7,332 deletions cra-react-app-rewired/pnpm-lock.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion cypress-e2e/fixtures/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,7 @@ export class Constants {
componentState: 'Component in Action..',
},
dynamicSystemHostApp: {
hostParagraph: 'The Dynamic System will take advantage Module Federation ',
hostParagraph: 'The Dynamic System will take advantage of Module Federation ',
paragraphText: [
'App2 Moment Dep',
'for format the date'
Expand Down
3 changes: 2 additions & 1 deletion cypress-e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"private": true,
"ignored": true,
"dependencies": {
"typescript": "^5.2.2"
"typescript": "^5.2.2",
"moment": "^2.30.1"
}
}
7 changes: 7 additions & 0 deletions dynamic-remotes-node/app1/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,12 @@ init({


loadRemote('app2/sample').then((sample) => {
if(process.env.TEST) {
if(sample === 'dynamically consumed from app2') {
process.exit(0)
} else {
process.exit(1)
}
}
console.log(sample)
});
19 changes: 11 additions & 8 deletions dynamic-remotes-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,24 @@
"license": "MIT",
"scripts": {
"serve": "concurrently 'serve -s app1/dist -l 3001' 'serve -s app2/dist -l 3002'",
"build:legacy": "rimraf dist/server && concurrently 'cd app1; webpack --config ./webpack.config.js' 'cd runtime-container; webpack --config ./webpack.config.js' 'cd app2; webpack --config ./webpack.config.js'",
"build": "rimraf dist/server && concurrently 'cd app1; rspack --config ./rspack.config.js' 'cd runtime-container; rspack --config ./rspack.config.js' 'cd app2; rspack --config ./rspack.config.js'",
"build:legacy": "rimraf dist/server && concurrently 'cd app1; webpack --config ./webpack.config.js' 'cd runtime-container; webpack --config ./webpack.config.js' 'cd app2; webpack --config ./webpack.config.js'",
"build": "rimraf dist/server && concurrently 'cd app1; rspack --config ./rspack.config.js' 'cd runtime-container; rspack --config ./rspack.config.js' 'cd app2; rspack --config ./rspack.config.js'",
"start:legacy": "pnpm build:legacy && concurrently 'pnpm serve' 'sleep 5 && node app1/dist/main.js'",
"start": "pnpm build && concurrently 'pnpm serve' 'sleep 5 && node app1/dist/main.js'"
"start": "pnpm build && concurrently 'TEST=true pnpm serve' 'sleep 5 && node app1/dist/main.js'"
},
"dependencies": {
"@module-federation/node": "2.2.9",
"@module-federation/enhanced": "0.1.18",
"@module-federation/runtime": "0.1.18",
"concurrently": "^8.0.1",
"webpack": "5.91.0",
"webpack": "^5.91.0",
"rimraf": "^5.0.5",
"webpack-cli": "^5.1.4",
"@rspack/cli": "0.6.5",
"@rspack/core": "0.6.5",
"@rspack/dev-server": "0.6.5"
"@rspack/cli": "^0.7.0-beta.0",
"@rspack/core": "^0.7.0-beta.0",
"@rspack/dev-server": "^0.7.0-beta.0"
},
"devDependencies": {
"kill-port": "^2.0.1"
}
}
}
10 changes: 1 addition & 9 deletions dynamic-system-host/app1/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
const {
container: { ModuleFederationPlugin },
} = require('@rspack/core');
const { ModuleFederationPlugin } = require('@module-federation/enhanced/rspack');
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');

Expand Down Expand Up @@ -64,10 +62,4 @@ module.exports = {
template: './public/index.html',
}),
],
// it will be fixed soon...
resolve: {
alias: {
'@module-federation/runtime$': require.resolve('@module-federation/runtime'),
},
},
};
31 changes: 12 additions & 19 deletions dynamic-system-host/app1/src/App.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { useState, lazy, Suspense } from 'react';
import { loadRemote, init } from '@module-federation/runtime';
import ReactDOM from 'react-dom';

Expand Down Expand Up @@ -27,7 +27,6 @@ init({
},
beforeLoadShare(args) {
console.log('beforeLoadShare: ', args);

return args;
},
},
Expand All @@ -53,32 +52,26 @@ init({
},
},
});
function System(props) {
const { request } = props;

const System = ({ request }) => {
if (!request) {
return <h2>No system specified</h2>;
}

const Component = React.lazy(() => loadRemote(request));
const Component = lazy(() => loadRemote(request));

return (
<React.Suspense fallback="Loading System">
<Suspense fallback="Loading System">
<Component />
</React.Suspense>
</Suspense>
);
}

function App() {
const [system, setSystem] = React.useState(false);
};

function setApp2() {
setSystem('app2/Widget');
}
const App = () => {
const [system, setSystem] = useState(null);

function setApp3() {
setSystem('app3/Widget');
}
const setApp2 = () => setSystem('app2/Widget');
const setApp3 = () => setSystem('app3/Widget');

return (
<div
Expand All @@ -90,7 +83,7 @@ function App() {
<h1>Dynamic System Host</h1>
<h2>App 1</h2>
<p>
The Dynamic System will take advantage Module Federation <strong>remotes</strong> and{' '}
The Dynamic System will take advantage of Module Federation <strong>remotes</strong> and{' '}
<strong>exposes</strong>. It will not load any components or modules that have been loaded
already.
</p>
Expand All @@ -101,6 +94,6 @@ function App() {
</div>
</div>
);
}
};

export default App;
4 changes: 1 addition & 3 deletions dynamic-system-host/app2/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
const {
container: { ModuleFederationPlugin },
} = require('@rspack/core');
const { ModuleFederationPlugin } = require('@module-federation/enhanced/rspack')
const HtmlWebpackPlugin = require('html-webpack-plugin');

const path = require('path');
Expand Down
4 changes: 1 addition & 3 deletions dynamic-system-host/app3/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
const {
container: { ModuleFederationPlugin },
} = require('@rspack/core');
const { ModuleFederationPlugin } = require('@module-federation/enhanced/rspack')
const HtmlWebpackPlugin = require('html-webpack-plugin');

const path = require('path');
Expand Down
4 changes: 2 additions & 2 deletions dynamic-system-host/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"legacy:build": "pnpm --filter dynamic-system-host_app* legacy:build",
"serve": "pnpm --filter dynamic-system-host_app* --parallel serve",
"clean": "pnpm --filter dynamic-system-host_app* --parallel clean",
"e2e:ci": "pnpm start & wait-on http-get://localhost:3001/ && npx cypress run --config-file ../cypress-e2e/config/cypress.config.ts --config '{\"supportFile\": \"../cypress-e2e/support/e2e.ts\"}' --spec \"./e2e/*.cy.ts\" --browser=chrome",
"legacy:e2e:ci": "pnpm legacy:start & wait-on http-get://localhost:3001/ && npx cypress run --config-file ../cypress-e2e/config/cypress.config.ts --config '{\"supportFile\": \"../cypress-e2e/support/e2e.ts\"}' --spec \"./e2e/*.cy.ts\" --browser=chrome"
"e2e:ci": "pnpm start & sleep 1 && wait-on tcp:3001 && npx cypress run --config-file ../cypress-e2e/config/cypress.config.ts --config '{\"supportFile\": \"../cypress-e2e/support/e2e.ts\"}' --spec \"./e2e/*.cy.ts\" --browser=chrome",
"legacy:e2e:ci": "pnpm legacy:start & sleep 1 && wait-on tcp:3001 tcp:3002 && npx cypress run --config-file ../cypress-e2e/config/cypress.config.ts --config '{\"supportFile\": \"../cypress-e2e/support/e2e.ts\"}' --spec \"./e2e/*.cy.ts\" --browser=chrome"
},
"devDependencies": {
"wait-on": "7.2.0"
Expand Down
Loading
Loading