@nx/react 20.4.0 → 20.4.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.4.0",
3
+ "version": "20.4.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": {
@@ -38,11 +38,11 @@
38
38
  "minimatch": "9.0.3",
39
39
  "picocolors": "^1.1.0",
40
40
  "tslib": "^2.3.0",
41
- "@nx/devkit": "20.4.0",
42
- "@nx/js": "20.4.0",
43
- "@nx/eslint": "20.4.0",
44
- "@nx/web": "20.4.0",
45
- "@nx/module-federation": "20.4.0",
41
+ "@nx/devkit": "20.4.2",
42
+ "@nx/js": "20.4.2",
43
+ "@nx/eslint": "20.4.2",
44
+ "@nx/web": "20.4.2",
45
+ "@nx/module-federation": "20.4.2",
46
46
  "express": "^4.21.2",
47
47
  "http-proxy-middleware": "^3.0.3",
48
48
  "semver": "^7.6.3"
@@ -5,7 +5,7 @@ const { join } = require('path');
5
5
 
6
6
  module.exports = {
7
7
  output: {
8
- path: join(__dirname, '<%= offsetFromRoot %><%= rspackPluginOptions.outputPath %>'),
8
+ path: join(__dirname, '<%= rspackPluginOptions.outputPath %>'),
9
9
  },
10
10
  devServer: {
11
11
  port: 4200,
@@ -5,7 +5,7 @@ const { join } = require('path');
5
5
 
6
6
  module.exports = {
7
7
  output: {
8
- path: join(__dirname, '<%= offsetFromRoot %><%= webpackPluginOptions.outputPath %>'),
8
+ path: join(__dirname, '<%= webpackPluginOptions.outputPath %>'),
9
9
  },
10
10
  devServer: {
11
11
  port: 4200,
@@ -33,11 +33,6 @@ function addProject(host, options) {
33
33
  name: options.projectName,
34
34
  version: '0.0.1',
35
35
  private: true,
36
- nx: options.parsedTags?.length
37
- ? {
38
- tags: options.parsedTags,
39
- }
40
- : undefined,
41
36
  });
42
37
  }
43
38
  if (!options.isUsingTsSolutionConfig || options.alwaysGenerateProjectJson) {
@@ -45,6 +40,15 @@ function addProject(host, options) {
45
40
  ...project,
46
41
  });
47
42
  }
43
+ else if (options.parsedTags?.length ||
44
+ Object.keys(project.targets).length) {
45
+ const updatedProject = {
46
+ root: options.appProjectRoot,
47
+ targets: project.targets,
48
+ tags: options.parsedTags?.length ? options.parsedTags : undefined,
49
+ };
50
+ (0, devkit_1.updateProjectConfiguration)(host, options.projectName, updatedProject);
51
+ }
48
52
  }
49
53
  function createRspackBuildTarget(options) {
50
54
  return {
@@ -52,7 +56,11 @@ function createRspackBuildTarget(options) {
52
56
  outputs: ['{options.outputPath}'],
53
57
  defaultConfiguration: 'production',
54
58
  options: {
55
- outputPath: (0, devkit_1.joinPathFragments)('dist', options.appProjectRoot),
59
+ outputPath: options.isUsingTsSolutionConfig
60
+ ? (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'dist')
61
+ : (0, devkit_1.joinPathFragments)('dist', options.appProjectRoot !== '.'
62
+ ? options.appProjectRoot
63
+ : options.projectName),
56
64
  index: (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'src/index.html'),
57
65
  baseHref: '/',
58
66
  main: (0, devkit_1.joinPathFragments)(options.appProjectRoot, (0, maybe_js_1.maybeJs)(options, `src/main.tsx`)),
@@ -111,9 +119,11 @@ function createBuildTarget(options) {
111
119
  defaultConfiguration: 'production',
112
120
  options: {
113
121
  compiler: options.compiler ?? 'babel',
114
- outputPath: (0, devkit_1.joinPathFragments)('dist', options.appProjectRoot != '.'
115
- ? options.appProjectRoot
116
- : options.projectName),
122
+ outputPath: options.isUsingTsSolutionConfig
123
+ ? (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'dist')
124
+ : (0, devkit_1.joinPathFragments)('dist', options.appProjectRoot !== '.'
125
+ ? options.appProjectRoot
126
+ : options.projectName),
117
127
  index: (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'src/index.html'),
118
128
  baseHref: '/',
119
129
  main: (0, devkit_1.joinPathFragments)(options.appProjectRoot, (0, maybe_js_1.maybeJs)(options, `src/main.tsx`)),
@@ -57,7 +57,7 @@ async function createApplicationFiles(host, options) {
57
57
  (0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, '../files/base-webpack'), options.appProjectRoot, {
58
58
  ...templateVariables,
59
59
  webpackPluginOptions: (0, has_webpack_plugin_1.hasWebpackPlugin)(host)
60
- ? createNxWebpackPluginOptions(options)
60
+ ? createNxWebpackPluginOptions(options, templateVariables.offsetFromRoot)
61
61
  : null,
62
62
  });
63
63
  if (options.compiler === 'babel') {
@@ -120,7 +120,7 @@ async function createApplicationFiles(host, options) {
120
120
  (0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, '../files/base-rspack'), options.appProjectRoot, {
121
121
  ...templateVariables,
122
122
  rspackPluginOptions: (0, has_rspack_plugin_1.hasRspackPlugin)(host)
123
- ? createNxRspackPluginOptions(options)
123
+ ? createNxRspackPluginOptions(options, templateVariables.offsetFromRoot)
124
124
  : null,
125
125
  });
126
126
  }
@@ -147,13 +147,15 @@ async function createApplicationFiles(host, options) {
147
147
  }
148
148
  (0, create_ts_config_1.createTsConfig)(host, options.appProjectRoot, 'app', options, relativePathToRootTsConfig);
149
149
  }
150
- function createNxWebpackPluginOptions(options) {
150
+ function createNxWebpackPluginOptions(options, rootOffset) {
151
151
  return {
152
152
  target: 'web',
153
153
  compiler: options.compiler ?? 'babel',
154
- outputPath: (0, devkit_1.joinPathFragments)('dist', options.appProjectRoot != '.'
155
- ? options.appProjectRoot
156
- : options.projectName),
154
+ outputPath: options.isUsingTsSolutionConfig
155
+ ? 'dist'
156
+ : (0, devkit_1.joinPathFragments)(rootOffset, 'dist', options.appProjectRoot != '.'
157
+ ? options.appProjectRoot
158
+ : options.projectName),
157
159
  index: './src/index.html',
158
160
  baseHref: '/',
159
161
  main: (0, maybe_js_1.maybeJs)({
@@ -169,12 +171,14 @@ function createNxWebpackPluginOptions(options) {
169
171
  ],
170
172
  };
171
173
  }
172
- function createNxRspackPluginOptions(options) {
174
+ function createNxRspackPluginOptions(options, rootOffset) {
173
175
  return {
174
176
  target: 'web',
175
- outputPath: (0, devkit_1.joinPathFragments)('dist', options.appProjectRoot != '.'
176
- ? options.appProjectRoot
177
- : options.projectName),
177
+ outputPath: options.isUsingTsSolutionConfig
178
+ ? 'dist'
179
+ : (0, devkit_1.joinPathFragments)(rootOffset, 'dist', options.appProjectRoot != '.'
180
+ ? options.appProjectRoot
181
+ : options.projectName),
178
182
  index: './src/index.html',
179
183
  baseHref: '/',
180
184
  main: (0, maybe_js_1.maybeJs)({