Skip to content

Commit fce107e

Browse files
feat(enhanced): make hoisted runtime the default implementation (#3453)
1 parent b0e7c8c commit fce107e

Some content is hidden

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

46 files changed

+1696
-1977
lines changed

.changeset/ai-eager-lion.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
"@module-federation/enhanced": minor
3+
---
4+
5+
Enhanced module federation plugin to remove the `federationRuntime` experiment and replace it with `asyncStartup`.
6+
7+
- Dropped support for `federationRuntime` experiment and introduced `asyncStartup` to enable asynchronous container startup.
8+
- Refactored EmbedFederationRuntimePlugin for improved runtime embedding and startup management.
9+
- Added options to enable runtime embedding for all chunks.
10+
- Integrated measures to ensure proper initialization and avoid duplicate hooks.
11+
- Simplified constructor and class dependencies by removing the `experiments` parameter.
12+
- Revised schema and validation definitions to accommodate new asynchronous startup configurations.
13+
- Updated test cases to reflect the change from `federationRuntime` to `asyncStartup`.

.changeset/ai-happy-bear.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@module-federation/nextjs-mf": patch
3+
---
4+
5+
- Changed experiment configuration from `federationRuntime: 'hoisted'` to `asyncStartup: true`.
6+
- Improved initialization logic in the runtime module to enable better caching and startup handling.

.changeset/ai-lazy-dog.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@module-federation/sdk": minor
3+
---
4+
5+
- Removed `federationRuntime` option from `ContainerPluginOptions`'s `experiments`.
6+
- Removed `federationRuntime` option from `ModuleFederationPluginOptions`'s `experiments`.
7+
- Added `asyncStartup` option to `ModuleFederationPluginOptions`'s `experiments`.

.cursorignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ tools/
5252
.vscode/
5353
.verdaccio/
5454

55+
!apps/manifest-demo/*.ts
56+
5557
# Ignore specific files
5658
.cursorignore
5759
jest.preset.js

.cursorrules

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
an assistant that engages in extremely thorough, self-questioning reasoning. Your approach mirrors human stream-of-
2+
consciousness thinking, characterized by continuous exploration, self-doubt, and iterative analysis.
3+
## Core Principles
4+
1. EXPLORATION OVER CONCLUSION
5+
- Never rush to conclusions
6+
- Keep exploring until a solution emerges naturally from the evidence
7+
- If uncertain, continue reasoning indefinitely
8+
- Question every assumption and inference
9+
2. DEPTH OF REASONING
10+
- Engage in extensive contemplation (minimum 10,000 characters)
11+
- Express thoughts in natural, conversational internal monologue
12+
- Break down complex thoughts into simple, atomic steps
13+
- Embrace uncertainty and revision of previous thoughts
14+
3. THINKING PROCESS
15+
- Use short, simple sentences that mirror natural thought patterns
16+
- Express uncertainty and internal debate freely
17+
- Show work-in-progress thinking
18+
- Acknowledge and explore dead ends
19+
- Frequently backtrack and revise
20+
- Contemplate before each new action
21+
- Contemplate after each and every step
22+
4. PERSISTENCE
23+
- Value thorough exploration over quick resolution
24+
## Output Format
25+
Your responses
26+
must follow this exact structure given below.
27+
Make sure
28+
to
29+
always include the final answer.
30+
...
31+
<contemplator>
32+
Your extensive internal monologue goes here
33+
- Begin with small, foundational observations
34+
- read each file related to the subject in full, make functional observations
35+
- Question each step thoroughly
36+
- Show natural thought progression
37+
- Express doubts and uncertainties
38+
- Revise and backtrack if you need to
39+
- Continue until natural resolution </contemplator>
40+

.github/workflows/e2e-next-dev.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ jobs:
4848
- name: E2E Test for Next.js Dev
4949
if: steps.check-ci.outcome == 'success'
5050
run: |
51+
npx kill-port 3000,3001,3002 &&
5152
pnpm run app:next:dev &
5253
sleep 1 &&
5354
npx wait-on tcp:3001 &&

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
/.nx
1010
# dependencies
1111
node_modules
12-
12+
./webpack-lib
1313
# IDEs and editors
1414
/.idea
1515
.project
@@ -70,4 +70,5 @@ packages/enhanced/test/js
7070
# storybook cases
7171
!apps/rslib-module/@mf-types/**
7272

73-
**/vite.config.{js,ts,mjs,mts,cjs,cts}.timestamp*
73+
**/vite.config.{js,ts,mjs,mts,cjs,cts}.timestamp*
74+
/webpack-lib/

apps/manifest-demo/3009-webpack-provider/webpack.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ module.exports = composePlugins(
1515
config.watchOptions = {
1616
ignored: ['**/node_modules/**', '**/@mf-types/**'],
1717
};
18+
config.devServer = {
19+
...config.devServer,
20+
devMiddleware: {
21+
writeToDisk: true,
22+
},
23+
};
1824
// publicPath must be specific url
1925
config.output.publicPath = 'auto';
2026
config.plugins.push(

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ module.exports = composePlugins(withNx(), withReact(), (config, context) => {
1313
};
1414
config.plugins.push(
1515
new ModuleFederationPlugin({
16+
runtime: false,
1617
name: 'manifest_host',
1718
remotes: {
1819
remote1: 'webpack_provider@http://localhost:3009/mf-manifest.json',
@@ -44,11 +45,10 @@ module.exports = composePlugins(withNx(), withReact(), (config, context) => {
4445
},
4546
},
4647
dataPrefetch: true,
47-
// experiments: { federationRuntime: 'hoisted' },
4848
runtimePlugins: [path.join(__dirname, './runtimePlugin.ts')],
4949
experiments: {
5050
provideExternalRuntime: true,
51-
federationRuntime: 'hoisted',
51+
asyncStartup: true,
5252
},
5353
}),
5454
);
@@ -61,7 +61,9 @@ module.exports = composePlugins(withNx(), withReact(), (config, context) => {
6161
});
6262
if (config.devServer) {
6363
config.devServer.client.overlay = false;
64+
config.devServer.devMiddleware.writeToDisk = true;
6465
}
66+
config.devtool = false;
6567
config.entry = './src/index.tsx';
6668
//Temporary workaround - https://github.com/nrwl/nx/issues/16983
6769
config.experiments = { outputModule: false };

apps/modernjs/modern.config.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,16 @@ export default defineConfig({
3535

3636
appendPlugins([
3737
new ModuleFederationPlugin({
38+
runtime: false,
3839
name: 'app1',
3940
exposes: {
4041
'./thing': './src/test.ts',
4142
'./react-component': './src/components/react-component.tsx',
4243
},
4344
runtimePlugins: ['./runtimePlugin.ts'],
45+
experiments: {
46+
asyncStartup: true,
47+
},
4448
filename: 'remoteEntry.js',
4549
shared: {
4650
'react/': {
@@ -60,9 +64,6 @@ export default defineConfig({
6064
requiredVersion: '^18.3.1',
6165
},
6266
},
63-
experiments: {
64-
federationRuntime: 'hoisted',
65-
},
6667
dataPrefetch: true,
6768
}) as any,
6869
]);

0 commit comments

Comments
 (0)