Skip to content

Commit

Permalink
fix(module-federation): use 'hoisted' runtime for node to prevent iss…
Browse files Browse the repository at this point in the history
…ues with eager sharing
  • Loading branch information
Coly010 committed Nov 28, 2024
1 parent 8eb6159 commit 847c5d0
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,19 @@ export async function withModuleFederationForSSR(
shared: {
...sharedDependencies,
},
remoteType: 'script',
library: {
type: 'commonjs-module',
},
/**
* Apply user-defined config override
*/
...(configOverride ? configOverride : {}),
experiments: {
federationRuntime: 'hoisted',
// We should allow users to override federationRuntime
...(configOverride?.experiments ?? {}),
},
runtimePlugins:
process.env.NX_MF_DEV_REMOTES &&
!options.disableNxRuntimeLibraryControlPlugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ export async function withModuleFederationForSSR(
* Apply user-defined config overrides
*/
...(configOverride ? configOverride : {}),
experiments: {
federationRuntime: 'hoisted',
// We should allow users to override federationRuntime
...(configOverride?.experiments ?? {}),
},
runtimePlugins:
process.env.NX_MF_DEV_REMOTES &&
!options.disableNxRuntimeLibraryControlPlugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,19 @@ export async function withModuleFederationForSSR(
shared: {
...sharedDependencies,
},
remoteType: 'script',
library: {
type: 'commonjs-module',
},
/**
* Apply user-defined config overrides
*/
...(configOverride ? configOverride : {}),
experiments: {
federationRuntime: 'hoisted',
// We should allow users to override federationRuntime
...(configOverride?.experiments ?? {}),
},
runtimePlugins:
process.env.NX_MF_DEV_REMOTES &&
!options.disableNxRuntimeLibraryControlPlugin
Expand Down

0 comments on commit 847c5d0

Please sign in to comment.