@nx/react 20.0.0 → 20.0.2

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.0.0",
3
+ "version": "20.0.2",
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.6",
42
- "@nx/devkit": "20.0.0",
43
- "@nx/js": "20.0.0",
44
- "@nx/eslint": "20.0.0",
45
- "@nx/web": "20.0.0",
42
+ "@nx/devkit": "20.0.2",
43
+ "@nx/js": "20.0.2",
44
+ "@nx/eslint": "20.0.2",
45
+ "@nx/web": "20.0.2",
46
46
  "express": "^4.19.2",
47
47
  "http-proxy-middleware": "^3.0.0"
48
48
  },
@@ -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(
@@ -8,7 +8,5 @@ function setupTspathForRemote(tree, options) {
8
8
  const project = (0, devkit_1.readProjectConfiguration)(tree, options.projectName);
9
9
  const exportPath = (0, maybe_js_1.maybeJs)(options, './src/remote-entry.ts');
10
10
  const exportName = 'Module';
11
- (0, js_1.addTsConfigPath)(tree, `${options.projectName}/${exportName}`, [
12
- (0, devkit_1.joinPathFragments)(project.root, exportPath),
13
- ]);
11
+ (0, js_1.addTsConfigPath)(tree, `${options.projectName.replace(/-/g, '_')}/${exportName}`, [(0, devkit_1.joinPathFragments)(project.root, exportPath)]);
14
12
  }
@@ -70,6 +70,14 @@ async function remoteGenerator(host, schema) {
70
70
  }
71
71
  }
72
72
  await (0, project_name_and_root_utils_1.ensureProjectName)(host, options, 'application');
73
+ const REMOTE_NAME_REGEX = '^[a-zA-Z_$][a-zA-Z_$0-9]*$';
74
+ const remoteNameRegex = new RegExp(REMOTE_NAME_REGEX);
75
+ if (!remoteNameRegex.test(options.projectName)) {
76
+ throw new Error((0, devkit_1.stripIndents) `Invalid remote name: ${options.projectName}. Remote project names must:
77
+ - Start with a letter, dollar sign ($) or underscore (_)
78
+ - Followed by any valid character (letters, digits, underscores, or dollar signs)
79
+ The regular expression used is ${REMOTE_NAME_REGEX}.`);
80
+ }
73
81
  const initAppTask = await (0, application_1.default)(host, {
74
82
  ...options,
75
83
  name: options.projectName,
@@ -116,7 +124,10 @@ async function remoteGenerator(host, schema) {
116
124
  (0, add_remote_to_dynamic_host_1.addRemoteToDynamicHost)(host, options.projectName, options.devServerPort, pathToMFManifest);
117
125
  }
118
126
  (0, add_mf_env_to_inputs_1.addMfEnvToTargetDefaultInputs)(host);
119
- const installTask = (0, devkit_1.addDependenciesToPackageJson)(host, {}, { '@module-federation/enhanced': versions_1.moduleFederationEnhancedVersion });
127
+ const installTask = (0, devkit_1.addDependenciesToPackageJson)(host, {}, {
128
+ '@module-federation/enhanced': versions_1.moduleFederationEnhancedVersion,
129
+ '@nx/web': versions_1.nxVersion,
130
+ });
120
131
  tasks.push(installTask);
121
132
  if (!options.skipFormat) {
122
133
  await (0, devkit_1.formatFiles)(host);
@@ -7,7 +7,7 @@ async function default_1(tree) {
7
7
  let usesModuleFederation = false;
8
8
  (0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nx/webpack:webpack', (options, projectName, targetName) => {
9
9
  const webpackConfig = options.webpackConfig;
10
- if (!webpackConfig) {
10
+ if (!webpackConfig || webpackConfig === '@nx/react/plugins/webpack') {
11
11
  return;
12
12
  }
13
13
  const webpackContents = tree.read(webpackConfig, 'utf-8');