@nx/react 19.7.0-canary.20240816-ce2dff3 → 19.7.0-canary.20240817-b91d788
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/migrations.json
CHANGED
@@ -53,6 +53,12 @@
|
|
53
53
|
"version": "19.6.0-beta.4",
|
54
54
|
"description": "Update the server file for Module Federation SSR port value to be the same as the 'serve' target port value.",
|
55
55
|
"factory": "./src/migrations/update-19-6-0/update-ssr-server-port"
|
56
|
+
},
|
57
|
+
"update-19-6-1-ensure-module-federation-target-defaults": {
|
58
|
+
"cli": "nx",
|
59
|
+
"version": "19.6.1-beta.0",
|
60
|
+
"description": "Ensure Target Defaults are set correctly for Module Federation.",
|
61
|
+
"factory": "./src/migrations/update-19-6-1/ensure-depends-on-for-mf"
|
56
62
|
}
|
57
63
|
},
|
58
64
|
"packageJsonUpdates": {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nx/react",
|
3
|
-
"version": "19.7.0-canary.
|
3
|
+
"version": "19.7.0-canary.20240817-b91d788",
|
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.7.0-canary.
|
43
|
-
"@nx/js": "19.7.0-canary.
|
44
|
-
"@nx/eslint": "19.7.0-canary.
|
45
|
-
"@nx/web": "19.7.0-canary.
|
46
|
-
"@nrwl/react": "19.7.0-canary.
|
42
|
+
"@nx/devkit": "19.7.0-canary.20240817-b91d788",
|
43
|
+
"@nx/js": "19.7.0-canary.20240817-b91d788",
|
44
|
+
"@nx/eslint": "19.7.0-canary.20240817-b91d788",
|
45
|
+
"@nx/web": "19.7.0-canary.20240817-b91d788",
|
46
|
+
"@nrwl/react": "19.7.0-canary.20240817-b91d788"
|
47
47
|
},
|
48
48
|
"publishConfig": {
|
49
49
|
"access": "public"
|
@@ -137,7 +137,11 @@ async function libraryGeneratorInternal(host, schema) {
|
|
137
137
|
"'react-dom'",
|
138
138
|
"'react/jsx-runtime'",
|
139
139
|
],
|
140
|
-
imports: [
|
140
|
+
imports: [
|
141
|
+
options.compiler === 'swc'
|
142
|
+
? `import react from '@vitejs/plugin-react-swc'`
|
143
|
+
: `import react from '@vitejs/plugin-react'`,
|
144
|
+
],
|
141
145
|
plugins: ['react()'],
|
142
146
|
}, true);
|
143
147
|
}
|
@@ -0,0 +1,46 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.default = default_1;
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
5
|
+
const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
|
6
|
+
async function default_1(tree) {
|
7
|
+
let usesModuleFederation = false;
|
8
|
+
(0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nx/webpack:webpack', (options, projectName, targetName) => {
|
9
|
+
const webpackConfig = options.webpackConfig;
|
10
|
+
if (!webpackConfig) {
|
11
|
+
return;
|
12
|
+
}
|
13
|
+
const webpackContents = tree.read(webpackConfig, 'utf-8');
|
14
|
+
if (['withModuleFederation', 'withModuleFederationForSSR'].some((p) => webpackContents.includes(p))) {
|
15
|
+
usesModuleFederation = true;
|
16
|
+
}
|
17
|
+
});
|
18
|
+
if (!usesModuleFederation) {
|
19
|
+
return;
|
20
|
+
}
|
21
|
+
const nxJson = (0, devkit_1.readNxJson)(tree);
|
22
|
+
const nxMFDevRemotesEnvVar = 'NX_MF_DEV_REMOTES';
|
23
|
+
if (!nxJson.targetDefaults ||
|
24
|
+
!nxJson.targetDefaults?.['@nx/webpack:webpack']) {
|
25
|
+
nxJson.targetDefaults ??= {};
|
26
|
+
nxJson.targetDefaults['@nx/webpack:webpack'] = {
|
27
|
+
cache: true,
|
28
|
+
inputs: ['production', '^production', { env: nxMFDevRemotesEnvVar }],
|
29
|
+
dependsOn: ['^build'],
|
30
|
+
};
|
31
|
+
}
|
32
|
+
else {
|
33
|
+
nxJson.targetDefaults['@nx/webpack:webpack'].dependsOn ??= [];
|
34
|
+
if (!nxJson.targetDefaults['@nx/webpack:webpack'].dependsOn.includes('^build')) {
|
35
|
+
nxJson.targetDefaults['@nx/webpack:webpack'].dependsOn.push('^build');
|
36
|
+
}
|
37
|
+
nxJson.targetDefaults['@nx/webpack:webpack'].inputs ??= [];
|
38
|
+
if (!nxJson.targetDefaults['@nx/webpack:webpack'].inputs.find((i) => typeof i === 'string' ? false : i['env'] === nxMFDevRemotesEnvVar)) {
|
39
|
+
nxJson.targetDefaults['@nx/webpack:webpack'].inputs.push({
|
40
|
+
env: nxMFDevRemotesEnvVar,
|
41
|
+
});
|
42
|
+
}
|
43
|
+
}
|
44
|
+
(0, devkit_1.updateNxJson)(tree, nxJson);
|
45
|
+
await (0, devkit_1.formatFiles)(tree);
|
46
|
+
}
|
@@ -12,6 +12,7 @@ function addMfEnvToTargetDefaultInputs(tree) {
|
|
12
12
|
'production',
|
13
13
|
'^production',
|
14
14
|
];
|
15
|
+
nxJson.targetDefaults[webpackExecutor].dependsOn ??= ['^build'];
|
15
16
|
let mfEnvVarExists = false;
|
16
17
|
for (const input of nxJson.targetDefaults[webpackExecutor].inputs) {
|
17
18
|
if (typeof input === 'object' && input['env'] === mfEnvVar) {
|