@nx/react 20.1.0-canary.20241017-c902036 → 20.1.0-canary.20241019-19e765f

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/react",
3
- "version": "20.1.0-canary.20241017-c902036",
3
+ "version": "20.1.0-canary.20241019-19e765f",
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,10 +39,10 @@
39
39
  "picocolors": "^1.1.0",
40
40
  "tslib": "^2.3.0",
41
41
  "@module-federation/enhanced": "0.6.9",
42
- "@nx/devkit": "20.1.0-canary.20241017-c902036",
43
- "@nx/js": "20.1.0-canary.20241017-c902036",
44
- "@nx/eslint": "20.1.0-canary.20241017-c902036",
45
- "@nx/web": "20.1.0-canary.20241017-c902036",
42
+ "@nx/devkit": "20.1.0-canary.20241019-19e765f",
43
+ "@nx/js": "20.1.0-canary.20241019-19e765f",
44
+ "@nx/eslint": "20.1.0-canary.20241019-19e765f",
45
+ "@nx/web": "20.1.0-canary.20241019-19e765f",
46
46
  "express": "^4.19.2",
47
47
  "http-proxy-middleware": "^3.0.0"
48
48
  },
@@ -130,8 +130,8 @@ async function* moduleFederationDevServer(options, context) {
130
130
  options.staticRemotesPort ??= remotes.staticRemotePort;
131
131
  // Set NX_MF_DEV_REMOTES for the Nx Runtime Library Control Plugin
132
132
  process.env.NX_MF_DEV_REMOTES = JSON.stringify([
133
- ...(remotes.devRemotes.map((r) => typeof r === 'string' ? r : r.remoteName) ?? []),
134
- p.name,
133
+ ...(remotes.devRemotes.map((r) => typeof r === 'string' ? r : r.remoteName) ?? []).map((r) => r.replace(/-/g, '_')),
134
+ p.name.replace(/-/g, '_'),
135
135
  ]);
136
136
  const staticRemotesConfig = (0, parse_static_remotes_config_1.parseStaticRemotesConfig)([...remotes.staticRemotes, ...remotes.dynamicRemotes], context);
137
137
  const mappedLocationsOfStaticRemotes = await (0, build_static_remotes_1.buildStaticRemotes)(staticRemotesConfig, nxBin, context, options);
@@ -164,8 +164,8 @@ async function* moduleFederationSsrDevServer(ssrDevServerOptions, context) {
164
164
  }, pathToManifestFile);
165
165
  options.staticRemotesPort ??= remotes.staticRemotePort;
166
166
  process.env.NX_MF_DEV_REMOTES = JSON.stringify([
167
- ...(remotes.devRemotes.map((r) => typeof r === 'string' ? r : r.remoteName) ?? []),
168
- projectConfig.name,
167
+ ...(remotes.devRemotes.map((r) => typeof r === 'string' ? r : r.remoteName) ?? []).map((r) => r.replace(/-/g, '_')),
168
+ projectConfig.name.replace(/-/g, '_'),
169
169
  ]);
170
170
  const staticRemotesConfig = (0, parse_static_remotes_config_1.parseStaticSsrRemotesConfig)([...remotes.staticRemotes, ...remotes.dynamicRemotes], context);
171
171
  const mappedLocationsOfStaticRemotes = await buildSsrStaticRemotes(staticRemotesConfig, nxBin, context, options);
@@ -28,6 +28,7 @@ const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-projec
28
28
  const setup_tailwind_1 = require("../setup-tailwind/setup-tailwind");
29
29
  const flat_config_1 = require("@nx/eslint/src/utils/flat-config");
30
30
  const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
31
+ const add_project_root_to_rspack_plugin_excludes_1 = require("./lib/add-project-root-to-rspack-plugin-excludes");
31
32
  async function addLinting(host, options) {
32
33
  const tasks = [];
33
34
  if (options.linter === eslint_1.Linter.EsLint) {
@@ -176,6 +177,7 @@ async function applicationGeneratorInternal(host, schema) {
176
177
  framework: 'react',
177
178
  });
178
179
  tasks.push(rspackTask);
180
+ (0, add_project_root_to_rspack_plugin_excludes_1.addProjectRootToRspackPluginExcludesIfExists)(host, options.appProjectRoot);
179
181
  }
180
182
  if (options.bundler !== 'vite' && options.unitTestRunner === 'vitest') {
181
183
  const { createOrEditViteConfig, vitestGenerator } = (0, devkit_1.ensurePackage)('@nx/vite', versions_1.nxVersion);
@@ -3,6 +3,7 @@ import * as ReactDOM from 'react-dom/client';
3
3
  <% if (routing) { %>import { BrowserRouter } from 'react-router-dom';<% } %>
4
4
 
5
5
  import App from './app/<%= fileName %>';
6
+ import './styles.<%= style %>'
6
7
 
7
8
  const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement);
8
9
  root.render(
@@ -0,0 +1,2 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export declare function addProjectRootToRspackPluginExcludesIfExists(tree: Tree, projectRoot: string): void;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addProjectRootToRspackPluginExcludesIfExists = addProjectRootToRspackPluginExcludesIfExists;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const devkit_2 = require("@nx/devkit");
6
+ function addProjectRootToRspackPluginExcludesIfExists(tree, projectRoot) {
7
+ const excludeProjectGlob = (0, devkit_1.joinPathFragments)(projectRoot, '/**');
8
+ const nxJson = (0, devkit_2.readNxJson)(tree);
9
+ if (!nxJson.plugins?.length) {
10
+ return;
11
+ }
12
+ for (let i = 0; i < nxJson.plugins.length; i++) {
13
+ let plugin = nxJson.plugins[i];
14
+ const isRspackPlugin = typeof plugin === 'string'
15
+ ? plugin === '@nx/rspack/plugin'
16
+ : plugin.plugin === '@nx/rspack/plugin';
17
+ if (isRspackPlugin) {
18
+ if (typeof plugin === 'string') {
19
+ plugin = {
20
+ plugin: plugin,
21
+ exclude: [excludeProjectGlob],
22
+ };
23
+ }
24
+ else {
25
+ plugin.exclude = [...(plugin.exclude ?? []), excludeProjectGlob];
26
+ }
27
+ nxJson.plugins[i] = plugin;
28
+ }
29
+ }
30
+ (0, devkit_1.updateNxJson)(tree, nxJson);
31
+ }