@nx/react 19.5.0 → 19.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +6 -6
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +2 -0
- package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js +2 -0
- package/src/module-federation/with-module-federation-ssr.js +12 -0
- package/src/module-federation/with-module-federation.js +12 -0
- package/src/utils/add-mf-env-to-inputs.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/react",
|
|
3
|
-
"version": "19.5.
|
|
3
|
+
"version": "19.5.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The React plugin for Nx contains executors and generators for managing React applications and libraries within an Nx workspace. It provides:\n\n\n- Integration with libraries such as Jest, Vitest, Playwright, Cypress, and Storybook.\n\n- Generators for applications, libraries, components, hooks, and more.\n\n- Library build support for publishing packages to npm or other registries.\n\n- Utilities for automatic workspace refactoring.",
|
|
6
6
|
"repository": {
|
|
@@ -39,11 +39,11 @@
|
|
|
39
39
|
"minimatch": "9.0.3",
|
|
40
40
|
"tslib": "^2.3.0",
|
|
41
41
|
"@module-federation/enhanced": "~0.2.3",
|
|
42
|
-
"@nx/devkit": "19.5.
|
|
43
|
-
"@nx/js": "19.5.
|
|
44
|
-
"@nx/eslint": "19.5.
|
|
45
|
-
"@nx/web": "19.5.
|
|
46
|
-
"@nrwl/react": "19.5.
|
|
42
|
+
"@nx/devkit": "19.5.1",
|
|
43
|
+
"@nx/js": "19.5.1",
|
|
44
|
+
"@nx/eslint": "19.5.1",
|
|
45
|
+
"@nx/web": "19.5.1",
|
|
46
|
+
"@nrwl/react": "19.5.1"
|
|
47
47
|
},
|
|
48
48
|
"publishConfig": {
|
|
49
49
|
"access": "public"
|
|
@@ -188,6 +188,8 @@ async function* moduleFederationDevServer(options, context) {
|
|
|
188
188
|
projectGraph: context.projectGraph,
|
|
189
189
|
root: context.root,
|
|
190
190
|
}, pathToManifestFile);
|
|
191
|
+
// Set NX_MF_DEV_REMOTES for the Nx Runtime Library Control Plugin
|
|
192
|
+
process.env.NX_MF_DEV_REMOTES = JSON.stringify(remotes.devRemotes.map((r) => (typeof r === 'string' ? r : r.remoteName)));
|
|
191
193
|
if (remotes.devRemotes.length > 0 && !initialStaticRemotesPorts) {
|
|
192
194
|
options.staticRemotesPort = options.devRemotes.reduce((portToUse, r) => {
|
|
193
195
|
const remoteName = typeof r === 'string' ? r : r.remoteName;
|
package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js
CHANGED
|
@@ -66,6 +66,8 @@ async function* moduleFederationSsrDevServer(options, context) {
|
|
|
66
66
|
: Array.isArray(options.devRemotes)
|
|
67
67
|
? options.devRemotes
|
|
68
68
|
: [options.devRemotes];
|
|
69
|
+
// Set NX_MF_DEV_REMOTES for the Nx Runtime Library Control Plugin
|
|
70
|
+
process.env.NX_MF_DEV_REMOTES = JSON.stringify(devServeApps);
|
|
69
71
|
for (const app of knownRemotes) {
|
|
70
72
|
const [appName] = Array.isArray(app) ? app : [app];
|
|
71
73
|
const isDev = devServeApps.includes(appName);
|
|
@@ -31,7 +31,19 @@ async function withModuleFederationForSSR(options, configOverride) {
|
|
|
31
31
|
* Apply user-defined config overrides
|
|
32
32
|
*/
|
|
33
33
|
...(configOverride ? configOverride : {}),
|
|
34
|
+
runtimePlugins: process.env.NX_MF_DEV_REMOTES &&
|
|
35
|
+
!options.disableNxRuntimeLibraryControlPlugin
|
|
36
|
+
? [
|
|
37
|
+
...(configOverride?.runtimePlugins ?? []),
|
|
38
|
+
require.resolve('@nx/webpack/src/utils/module-federation/plugins/runtime-library-control.plugin.js'),
|
|
39
|
+
]
|
|
40
|
+
: configOverride?.runtimePlugins,
|
|
34
41
|
}, {}), sharedLibraries.getReplacementPlugin());
|
|
42
|
+
// The env var is only set from the module-federation-dev-server
|
|
43
|
+
// Attach the runtime plugin
|
|
44
|
+
config.plugins.push(new (require('webpack').DefinePlugin)({
|
|
45
|
+
'process.env.NX_MF_DEV_REMOTES': process.env.NX_MF_DEV_REMOTES,
|
|
46
|
+
}));
|
|
35
47
|
return config;
|
|
36
48
|
};
|
|
37
49
|
}
|
|
@@ -52,7 +52,19 @@ async function withModuleFederation(options, configOverride) {
|
|
|
52
52
|
* Apply user-defined config overrides
|
|
53
53
|
*/
|
|
54
54
|
...(configOverride ? configOverride : {}),
|
|
55
|
+
runtimePlugins: process.env.NX_MF_DEV_REMOTES &&
|
|
56
|
+
!options.disableNxRuntimeLibraryControlPlugin
|
|
57
|
+
? [
|
|
58
|
+
...(configOverride?.runtimePlugins ?? []),
|
|
59
|
+
require.resolve('@nx/webpack/src/utils/module-federation/plugins/runtime-library-control.plugin.js'),
|
|
60
|
+
]
|
|
61
|
+
: configOverride?.runtimePlugins,
|
|
55
62
|
}), sharedLibraries.getReplacementPlugin());
|
|
63
|
+
// The env var is only set from the module-federation-dev-server
|
|
64
|
+
// Attach the runtime plugin
|
|
65
|
+
config.plugins.push(new (require('webpack').DefinePlugin)({
|
|
66
|
+
'process.env.NX_MF_DEV_REMOTES': process.env.NX_MF_DEV_REMOTES,
|
|
67
|
+
}));
|
|
56
68
|
return config;
|
|
57
69
|
};
|
|
58
70
|
}
|
|
@@ -5,7 +5,7 @@ const devkit_1 = require("@nx/devkit");
|
|
|
5
5
|
function addMfEnvToTargetDefaultInputs(tree) {
|
|
6
6
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
7
7
|
const webpackExecutor = '@nx/webpack:webpack';
|
|
8
|
-
const mfEnvVar = '
|
|
8
|
+
const mfEnvVar = 'NX_MF_DEV_REMOTES';
|
|
9
9
|
nxJson.targetDefaults ??= {};
|
|
10
10
|
nxJson.targetDefaults[webpackExecutor] ??= {};
|
|
11
11
|
nxJson.targetDefaults[webpackExecutor].inputs ??= [
|