@nx/react-native 24.0.0-beta.2 → 24.0.0-beta.3

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.
Files changed (71) hide show
  1. package/dist/src/generators/application/application.js +2 -3
  2. package/dist/src/generators/application/lib/add-project.js +1 -83
  3. package/dist/src/generators/application/lib/normalize-options.js +0 -4
  4. package/dist/src/generators/application/schema.d.ts +0 -1
  5. package/dist/src/generators/convert-to-inferred/lib/create-process-options.d.ts +2 -2
  6. package/dist/src/generators/convert-to-inferred/lib/create-process-options.js +2 -2
  7. package/dist/src/generators/init/init.js +44 -53
  8. package/dist/src/generators/init/schema.d.ts +0 -1
  9. package/dist/src/generators/library/lib/normalize-options.js +0 -5
  10. package/dist/src/generators/library/library.js +2 -3
  11. package/dist/src/generators/library/schema.d.ts +0 -1
  12. package/dist/src/generators/web-configuration/files/base-vite/vite.config.mts__tmpl__ +6 -5
  13. package/dist/src/generators/web-configuration/files/base-webpack/webpack.config.js__tmpl__ +2 -51
  14. package/dist/src/generators/web-configuration/lib/webpack-targets.d.ts +1 -3
  15. package/dist/src/generators/web-configuration/lib/webpack-targets.js +0 -57
  16. package/dist/src/generators/web-configuration/web-configuration.js +9 -18
  17. package/dist/src/migrations/update-24-0-0/finish-inferred-conversion.md +12 -0
  18. package/dist/src/migrations/update-24-0-0/remove-deprecated-executors.d.ts +6 -0
  19. package/dist/src/migrations/update-24-0-0/remove-deprecated-executors.js +30 -0
  20. package/dist/src/migrations/update-24-0-0/remove-deprecated-executors.md +68 -0
  21. package/dist/src/utils/add-jest.d.ts +1 -1
  22. package/dist/src/utils/add-jest.js +1 -2
  23. package/dist/src/utils/add-linting.d.ts +0 -1
  24. package/dist/src/utils/add-linting.js +0 -1
  25. package/dist/src/utils/chmod-android-gradle-files.d.ts +0 -1
  26. package/dist/src/utils/chmod-android-gradle-files.js +0 -1
  27. package/dist/src/utils/pod-install-task.d.ts +0 -6
  28. package/dist/src/utils/pod-install-task.js +0 -1
  29. package/dist/src/utils/versions.d.ts +1 -0
  30. package/dist/src/utils/versions.js +2 -1
  31. package/executors.json +0 -40
  32. package/migrations.json +7 -0
  33. package/package.json +9 -9
  34. package/dist/src/executors/build-android/build-android.impl.d.ts +0 -6
  35. package/dist/src/executors/build-android/build-android.impl.js +0 -53
  36. package/dist/src/executors/build-android/schema.d.ts +0 -13
  37. package/dist/src/executors/build-android/schema.json +0 -82
  38. package/dist/src/executors/build-ios/build-ios.impl.d.ts +0 -6
  39. package/dist/src/executors/build-ios/build-ios.impl.js +0 -60
  40. package/dist/src/executors/build-ios/schema.d.ts +0 -17
  41. package/dist/src/executors/build-ios/schema.json +0 -92
  42. package/dist/src/executors/bundle/bundle.impl.d.ts +0 -6
  43. package/dist/src/executors/bundle/bundle.impl.js +0 -61
  44. package/dist/src/executors/bundle/schema.d.ts +0 -16
  45. package/dist/src/executors/bundle/schema.json +0 -93
  46. package/dist/src/executors/pod-install/pod-install.impl.d.ts +0 -6
  47. package/dist/src/executors/pod-install/pod-install.impl.js +0 -13
  48. package/dist/src/executors/pod-install/schema.d.ts +0 -6
  49. package/dist/src/executors/pod-install/schema.json +0 -34
  50. package/dist/src/executors/run-android/run-android.impl.d.ts +0 -6
  51. package/dist/src/executors/run-android/run-android.impl.js +0 -71
  52. package/dist/src/executors/run-android/schema.d.ts +0 -12
  53. package/dist/src/executors/run-android/schema.json +0 -102
  54. package/dist/src/executors/run-ios/run-ios.impl.d.ts +0 -6
  55. package/dist/src/executors/run-ios/run-ios.impl.js +0 -70
  56. package/dist/src/executors/run-ios/schema.d.ts +0 -7
  57. package/dist/src/executors/run-ios/schema.json +0 -98
  58. package/dist/src/executors/start/lib/is-packager-running.d.ts +0 -1
  59. package/dist/src/executors/start/lib/is-packager-running.js +0 -13
  60. package/dist/src/executors/start/schema.d.ts +0 -7
  61. package/dist/src/executors/start/schema.json +0 -30
  62. package/dist/src/executors/start/start.impl.d.ts +0 -9
  63. package/dist/src/executors/start/start.impl.js +0 -91
  64. package/dist/src/executors/upgrade/schema.d.ts +0 -1
  65. package/dist/src/executors/upgrade/schema.json +0 -12
  66. package/dist/src/executors/upgrade/upgrade.impl.d.ts +0 -12
  67. package/dist/src/executors/upgrade/upgrade.impl.js +0 -51
  68. package/dist/src/utils/deprecation.d.ts +0 -2
  69. package/dist/src/utils/deprecation.js +0 -19
  70. package/dist/src/utils/get-cli-options.d.ts +0 -8
  71. package/dist/src/utils/get-cli-options.js +0 -32
@@ -22,7 +22,6 @@ const sync_deps_impl_1 = require("../../executors/sync-deps/sync-deps.impl");
22
22
  const internal_2 = require("@nx/js/internal");
23
23
  async function reactNativeApplicationGenerator(host, schema) {
24
24
  return await reactNativeApplicationGeneratorInternal(host, {
25
- addPlugin: false,
26
25
  useProjectJson: true,
27
26
  ...schema,
28
27
  });
@@ -30,7 +29,7 @@ async function reactNativeApplicationGenerator(host, schema) {
30
29
  async function reactNativeApplicationGeneratorInternal(host, schema) {
31
30
  (0, versions_1.assertSupportedReactNativeVersion)(host);
32
31
  const tasks = [];
33
- const addTsPlugin = (0, internal_2.shouldConfigureTsSolutionSetup)(host, schema.addPlugin, schema.useTsSolution);
32
+ const addTsPlugin = (0, internal_2.shouldConfigureTsSolutionSetup)(host, schema.useTsSolution);
34
33
  const jsInitTask = await (0, js_1.initGenerator)(host, {
35
34
  ...schema,
36
35
  skipFormat: true,
@@ -59,7 +58,7 @@ async function reactNativeApplicationGeneratorInternal(host, schema) {
59
58
  ],
60
59
  });
61
60
  tasks.push(lintTask);
62
- const jestTask = await (0, add_jest_1.addJest)(host, options.unitTestRunner, options.projectName, options.appProjectRoot, options.js, options.skipPackageJson, options.addPlugin, 'tsconfig.app.json');
61
+ const jestTask = await (0, add_jest_1.addJest)(host, options.unitTestRunner, options.projectName, options.appProjectRoot, options.js, options.skipPackageJson, 'tsconfig.app.json');
63
62
  tasks.push(jestTask);
64
63
  const webTask = await (0, web_configuration_1.webConfigurationGenerator)(host, {
65
64
  ...options,
@@ -2,20 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.addProject = addProject;
4
4
  const devkit_1 = require("@nx/devkit");
5
- const deprecation_1 = require("../../../utils/deprecation");
6
5
  function addProject(host, options) {
7
- const nxJson = (0, devkit_1.readNxJson)(host);
8
- const hasPlugin = nxJson.plugins?.some((p) => typeof p === 'string'
9
- ? p === '@nx/react-native/plugin'
10
- : p.plugin === '@nx/react-native/plugin');
11
- if (!hasPlugin) {
12
- (0, deprecation_1.warnReactNativeExecutorGenerating)();
13
- }
14
6
  const project = {
15
7
  root: options.appProjectRoot,
16
8
  sourceRoot: `${options.appProjectRoot}/src`,
17
9
  projectType: 'application',
18
- targets: hasPlugin ? {} : getTargets(options),
10
+ targets: {},
19
11
  tags: options.parsedTags,
20
12
  };
21
13
  const templatedPackageJson = (0, devkit_1.readJson)(host, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'package.json'));
@@ -29,10 +21,6 @@ function addProject(host, options) {
29
21
  if (options.projectName !== options.importPath) {
30
22
  packageJson.nx = { name: options.projectName };
31
23
  }
32
- if (!hasPlugin) {
33
- packageJson.nx ??= {};
34
- packageJson.nx.targets = getTargets(options);
35
- }
36
24
  if (options.parsedTags?.length) {
37
25
  packageJson.nx ??= {};
38
26
  packageJson.nx.tags = options.parsedTags;
@@ -47,73 +35,3 @@ function addProject(host, options) {
47
35
  (0, devkit_1.writeJson)(host, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'package.json'), packageJson);
48
36
  }
49
37
  }
50
- function getTargets(options) {
51
- const architect = {};
52
- architect.start = {
53
- executor: '@nx/react-native:start',
54
- dependsOn: [],
55
- options: {
56
- port: 8081,
57
- },
58
- };
59
- architect['run-ios'] = {
60
- executor: '@nx/react-native:run-ios',
61
- dependsOn: [],
62
- options: {},
63
- };
64
- architect['bundle-ios'] = {
65
- executor: '@nx/react-native:bundle',
66
- dependsOn: [],
67
- outputs: ['{options.bundleOutput}'],
68
- options: {
69
- entryFile: options.entryFile,
70
- platform: 'ios',
71
- bundleOutput: `dist/${options.appProjectRoot}/ios/main.jsbundle`,
72
- },
73
- };
74
- architect['run-android'] = {
75
- executor: '@nx/react-native:run-android',
76
- dependsOn: [],
77
- options: {},
78
- };
79
- architect['build-android'] = {
80
- executor: '@nx/react-native:build-android',
81
- outputs: [
82
- `{projectRoot}/android/app/build/outputs/bundle`,
83
- `{projectRoot}/android/app/build/outputs/apk`,
84
- ],
85
- dependsOn: [],
86
- options: {},
87
- };
88
- architect['build-ios'] = {
89
- executor: '@nx/react-native:build-ios',
90
- outputs: ['{projectRoot}/ios/build/Build'],
91
- dependsOn: [],
92
- options: {},
93
- };
94
- architect['pod-install'] = {
95
- executor: '@nx/react-native:pod-install',
96
- dependsOn: ['sync-deps'],
97
- outputs: ['{projectRoot}/ios/Pods', '{projectRoot}/ios/Podfile.lock'],
98
- options: {},
99
- };
100
- architect.upgrade = {
101
- executor: '@nx/react-native:upgrade',
102
- options: {},
103
- };
104
- architect['bundle-android'] = {
105
- executor: '@nx/react-native:bundle',
106
- dependsOn: [],
107
- outputs: ['{options.bundleOutput}'],
108
- options: {
109
- entryFile: options.entryFile,
110
- platform: 'android',
111
- bundleOutput: `dist/${options.appProjectRoot}/android/main.jsbundle`,
112
- },
113
- };
114
- architect['sync-deps'] = {
115
- executor: '@nx/react-native:sync-deps',
116
- options: {},
117
- };
118
- return architect;
119
- }
@@ -11,10 +11,6 @@ async function normalizeOptions(host, options) {
11
11
  projectType: 'application',
12
12
  directory: options.directory,
13
13
  });
14
- const nxJson = (0, devkit_1.readNxJson)(host);
15
- const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' &&
16
- nxJson.useInferencePlugins !== false;
17
- options.addPlugin ??= addPluginDefault;
18
14
  const { className, fileName } = (0, devkit_1.names)(projectNames.projectSimpleName);
19
15
  const iosProjectRoot = (0, devkit_1.joinPathFragments)(appProjectRoot, 'ios');
20
16
  const androidProjectRoot = (0, devkit_1.joinPathFragments)(appProjectRoot, 'android');
@@ -21,7 +21,6 @@ export interface Schema {
21
21
  install: boolean; // default is true
22
22
  skipPackageJson?: boolean; //default is false
23
23
  // Internal options
24
- addPlugin?: boolean;
25
24
  nxCloudToken?: string;
26
25
  useTsSolution?: boolean;
27
26
  formatter?: 'prettier' | 'oxfmt' | 'none';
@@ -1,6 +1,6 @@
1
1
  import type { AggregatedLog } from '@nx/devkit/internal';
2
2
  /**
3
- * Logic copied from `packages/react-native/src/utils/get-cli-options.ts`,
4
- * which was used by most executors to map their options to CLI options.
3
+ * Maps options to CLI args the way the removed executors did, so converted
4
+ * targets run the same React Native CLI command.
5
5
  */
6
6
  export declare function createProcessOptions(executorName: string, optionKeysToIgnore: string[], optionKeysInCamelName: string[]): (projectName: string, options: any, migrationLogs: AggregatedLog) => void;
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createProcessOptions = createProcessOptions;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  /**
6
- * Logic copied from `packages/react-native/src/utils/get-cli-options.ts`,
7
- * which was used by most executors to map their options to CLI options.
6
+ * Maps options to CLI args the way the removed executors did, so converted
7
+ * targets run the same React Native CLI command.
8
8
  */
9
9
  function createProcessOptions(executorName, optionKeysToIgnore, optionKeysInCamelName) {
10
10
  return (projectName, options, migrationLogs) => {
@@ -9,63 +9,54 @@ const plugin_1 = require("../../../plugins/plugin");
9
9
  const versions_1 = require("../../utils/versions");
10
10
  const add_git_ignore_entry_1 = require("./lib/add-git-ignore-entry");
11
11
  function reactNativeInitGenerator(host, schema) {
12
- return reactNativeInitGeneratorInternal(host, {
13
- addPlugin: false,
14
- ...schema,
15
- });
12
+ return reactNativeInitGeneratorInternal(host, schema);
16
13
  }
17
14
  async function reactNativeInitGeneratorInternal(host, schema) {
18
15
  (0, versions_1.assertSupportedReactNativeVersion)(host);
19
16
  (0, add_git_ignore_entry_1.addGitIgnoreEntry)(host);
20
- const nxJson = (0, devkit_1.readNxJson)(host);
21
- const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' &&
22
- nxJson.useInferencePlugins !== false;
23
- schema.addPlugin ??= addPluginDefault;
24
- if (schema.addPlugin) {
25
- await (0, internal_1.addPlugin)(host, await (0, devkit_1.createProjectGraphAsync)(), '@nx/react-native/plugin', plugin_1.createNodesV2, {
26
- startTargetName: ['start', 'react-native:start', 'react-native-start'],
27
- upgradeTargetName: [
28
- 'update',
29
- 'react-native:update',
30
- 'react-native-update',
31
- ],
32
- bundleTargetName: [
33
- 'bundle',
34
- 'react-native:bundle',
35
- 'react-native-bundle',
36
- ],
37
- podInstallTargetName: [
38
- 'pod-install',
39
- 'react-native:pod-install',
40
- 'react-native-pod-install',
41
- ],
42
- runIosTargetName: [
43
- 'run-ios',
44
- 'react-native:run-ios',
45
- 'react-native-run-ios',
46
- ],
47
- runAndroidTargetName: [
48
- 'run-android',
49
- 'react-native:run-android',
50
- 'react-native-run-android',
51
- ],
52
- buildIosTargetName: [
53
- 'build-ios',
54
- 'react-native:build-ios',
55
- 'react-native-build-ios',
56
- ],
57
- buildAndroidTargetName: [
58
- 'build-android',
59
- 'react-native:build-android',
60
- 'react-native-build-android',
61
- ],
62
- syncDepsTargetName: [
63
- 'sync-deps',
64
- 'react-native:sync-deps',
65
- 'react-native-sync-deps',
66
- ],
67
- }, schema.updatePackageScripts);
68
- }
17
+ await (0, internal_1.addPlugin)(host, await (0, devkit_1.createProjectGraphAsync)(), '@nx/react-native/plugin', plugin_1.createNodesV2, {
18
+ startTargetName: ['start', 'react-native:start', 'react-native-start'],
19
+ upgradeTargetName: [
20
+ 'update',
21
+ 'react-native:update',
22
+ 'react-native-update',
23
+ ],
24
+ bundleTargetName: [
25
+ 'bundle',
26
+ 'react-native:bundle',
27
+ 'react-native-bundle',
28
+ ],
29
+ podInstallTargetName: [
30
+ 'pod-install',
31
+ 'react-native:pod-install',
32
+ 'react-native-pod-install',
33
+ ],
34
+ runIosTargetName: [
35
+ 'run-ios',
36
+ 'react-native:run-ios',
37
+ 'react-native-run-ios',
38
+ ],
39
+ runAndroidTargetName: [
40
+ 'run-android',
41
+ 'react-native:run-android',
42
+ 'react-native-run-android',
43
+ ],
44
+ buildIosTargetName: [
45
+ 'build-ios',
46
+ 'react-native:build-ios',
47
+ 'react-native-build-ios',
48
+ ],
49
+ buildAndroidTargetName: [
50
+ 'build-android',
51
+ 'react-native:build-android',
52
+ 'react-native-build-android',
53
+ ],
54
+ syncDepsTargetName: [
55
+ 'sync-deps',
56
+ 'react-native:sync-deps',
57
+ 'react-native-sync-deps',
58
+ ],
59
+ }, schema.updatePackageScripts);
69
60
  const tasks = [];
70
61
  if (!schema.skipPackageJson) {
71
62
  tasks.push(moveDependency(host));
@@ -3,5 +3,4 @@ export interface Schema {
3
3
  skipPackageJson?: boolean; //default is false
4
4
  keepExistingVersions?: boolean; //default is true
5
5
  updatePackageScripts?: boolean;
6
- addPlugin?: boolean;
7
6
  }
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.normalizeOptions = normalizeOptions;
4
- const devkit_1 = require("@nx/devkit");
5
4
  const internal_1 = require("@nx/devkit/internal");
6
5
  const internal_2 = require("@nx/js/internal");
7
6
  async function normalizeOptions(host, options) {
@@ -12,10 +11,6 @@ async function normalizeOptions(host, options) {
12
11
  directory: options.directory,
13
12
  importPath: options.importPath,
14
13
  });
15
- const nxJson = (0, devkit_1.readNxJson)(host);
16
- const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' &&
17
- nxJson.useInferencePlugins !== false;
18
- options.addPlugin ??= addPluginDefault;
19
14
  const parsedTags = options.tags
20
15
  ? options.tags.split(',').map((s) => s.trim())
21
16
  : [];
@@ -18,7 +18,6 @@ const path_1 = require("path");
18
18
  const versions_1 = require("../../utils/versions");
19
19
  async function reactNativeLibraryGenerator(host, schema) {
20
20
  return await reactNativeLibraryGeneratorInternal(host, {
21
- addPlugin: false,
22
21
  useProjectJson: true,
23
22
  ...schema,
24
23
  });
@@ -26,7 +25,7 @@ async function reactNativeLibraryGenerator(host, schema) {
26
25
  async function reactNativeLibraryGeneratorInternal(host, schema) {
27
26
  (0, versions_1.assertSupportedReactNativeVersion)(host);
28
27
  const tasks = [];
29
- const addTsPlugin = (0, internal_2.shouldConfigureTsSolutionSetup)(host, schema.addPlugin);
28
+ const addTsPlugin = (0, internal_2.shouldConfigureTsSolutionSetup)(host);
30
29
  const jsInitTask = await (0, js_1.initGenerator)(host, {
31
30
  ...schema,
32
31
  addTsPlugin,
@@ -58,7 +57,7 @@ async function reactNativeLibraryGeneratorInternal(host, schema) {
58
57
  ],
59
58
  });
60
59
  tasks.push(lintTask);
61
- const jestTask = await (0, add_jest_1.addJest)(host, options.unitTestRunner, options.name, options.projectRoot, options.js, options.skipPackageJson, options.addPlugin, 'tsconfig.lib.json');
60
+ const jestTask = await (0, add_jest_1.addJest)(host, options.unitTestRunner, options.name, options.projectRoot, options.js, options.skipPackageJson, 'tsconfig.lib.json');
62
61
  tasks.push(jestTask);
63
62
  const relativeCwd = (0, internal_1.getRelativeCwd)();
64
63
  const path = (0, devkit_1.joinPathFragments)(options.projectRoot, 'src/lib', options.js ? `${options.fileName}.js` : options.fileName);
@@ -22,6 +22,5 @@ export interface Schema {
22
22
  */
23
23
  setParserOptionsProject?: boolean;
24
24
  skipPackageJson?: boolean; //default is false
25
- addPlugin?: boolean;
26
25
  useProjectJson?: boolean;
27
26
  }
@@ -1,7 +1,7 @@
1
1
  import { defineConfig, transformWithEsbuild } from 'vite';
2
2
  import react from '@vitejs/plugin-react';
3
- import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
4
- import { readFileSync } from 'fs';
3
+ <% if (!useNativeTsconfigPaths) { %>import tsconfigPaths from 'vite-tsconfig-paths';
4
+ <% } %>import { readFileSync } from 'fs';
5
5
 
6
6
  const extensions = [
7
7
  '.mjs',
@@ -37,7 +37,8 @@ export default defineConfig({
37
37
  global: 'window',
38
38
  },
39
39
  resolve: {
40
- extensions,
40
+ <% if (useNativeTsconfigPaths) { %> tsconfigPaths: true,
41
+ <% } %> extensions,
41
42
  alias: {
42
43
  'react-native': 'react-native-web',
43
44
  'react-native-svg': 'react-native-svg-web',
@@ -72,9 +73,9 @@ export default defineConfig({
72
73
  loader: { '.js': 'jsx' },
73
74
  },
74
75
  },
75
- plugins: [react(), nxViteTsPaths()],
76
+ plugins: [react()<% if (!useNativeTsconfigPaths) { %>, tsconfigPaths({ loose: true })<% } %>],
76
77
  // Uncomment this if you are using workers.
77
78
  // worker: {
78
- // plugins: () => [ nxViteTsPaths() ],
79
+ // plugins: [],
79
80
  // },
80
81
  });
@@ -1,4 +1,4 @@
1
- <% if (webpackPluginOptions) { %>
1
+
2
2
  const { NxAppWebpackPlugin } = require('@nx/webpack/app-plugin');
3
3
  const { NxReactWebpackPlugin } = require('@nx/react/webpack-plugin');
4
4
 
@@ -27,56 +27,7 @@ module.exports = {
27
27
  outputHashing: process.env['NODE_ENV'] === 'production' ? 'all' : 'none',
28
28
  optimization: process.env['NODE_ENV'] === 'production',
29
29
  }),
30
- new NxReactWebpackPlugin({
31
- // Uncomment this line if you don't want to use SVGR
32
- // See: https://react-svgr.com/
33
- // svgr: false
34
- }),
30
+ new NxReactWebpackPlugin(),
35
31
  ],
36
32
  };
37
- <% } else { %>
38
- const { composePlugins, withNx } = require('@nx/webpack');
39
- const { withReact } = require('@nx/react');
40
33
 
41
- // Nx plugins for webpack.
42
- module.exports = composePlugins(
43
- withNx(),
44
- withReact({
45
- // Uncomment this line if you don't want to use SVGR
46
- // See: https://react-svgr.com/
47
- // svgr: false
48
- }),
49
- (config) => {
50
- // Update the webpack config as needed here.
51
- // e.g. `config.plugins.push(new MyPlugin())`
52
-
53
- config.output.clean = true;
54
- config.resolve.alias = {
55
- ...config.resolve.alias ?? {},
56
- 'react-native$': 'react-native-web',
57
- 'react-native-svg': 'react-native-svg-web',
58
- '@react-native/assets-registry/registry': 'react-native-web/dist/modules/AssetRegistry/index',
59
- };
60
- config.resolve.extensions = [
61
- '.web.tsx',
62
- '.web.ts',
63
- '.web.jsx',
64
- '.web.js',
65
- ...config.resolve.extensions,
66
- ];
67
- config.module.rules.push({
68
- test: /\.(js|jsx)$/,
69
- include: /react-native-vector-icons/,
70
- loader: 'babel-loader',
71
- options: {
72
- presets: [
73
- '@babel/preset-env',
74
- ['@babel/preset-react', { runtime: 'automatic' }],
75
- ],
76
- },
77
- });
78
-
79
- return config;
80
- }
81
- );
82
- <% } %>
@@ -1,8 +1,6 @@
1
- import { TargetConfiguration, Tree } from '@nx/devkit';
1
+ import { Tree } from '@nx/devkit';
2
2
  import type { WithReactOptions } from '@nx/react';
3
3
  import type { WithNxOptions } from '@nx/webpack';
4
4
  import { NormalizedSchema } from './normalize-schema';
5
- export declare function createBuildTarget(tree: Tree, options: NormalizedSchema): TargetConfiguration;
6
- export declare function createServeTarget(options: NormalizedSchema): TargetConfiguration;
7
5
  export declare function createNxWebpackPluginOptions(tree: Tree, options: NormalizedSchema): WithNxOptions & WithReactOptions;
8
6
  export declare function determineTsConfig(tree: Tree, options: NormalizedSchema): "tsconfig.app.json" | "tsconfig.json" | "tsconfig.lib.json";
@@ -1,65 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createBuildTarget = createBuildTarget;
4
- exports.createServeTarget = createServeTarget;
5
3
  exports.createNxWebpackPluginOptions = createNxWebpackPluginOptions;
6
4
  exports.determineTsConfig = determineTsConfig;
7
5
  const devkit_1 = require("@nx/devkit");
8
- function createBuildTarget(tree, options) {
9
- return {
10
- executor: '@nx/webpack:webpack',
11
- outputs: ['{options.outputPath}'],
12
- defaultConfiguration: 'production',
13
- options: {
14
- compiler: 'babel',
15
- outputPath: (0, devkit_1.joinPathFragments)('dist', options.projectRoot != '.' ? options.projectRoot : options.project, 'web'),
16
- index: (0, devkit_1.joinPathFragments)(options.projectRoot, 'src/index.html'),
17
- baseHref: '/',
18
- main: (0, devkit_1.joinPathFragments)(options.projectRoot, `src/main-web.tsx`),
19
- tsConfig: (0, devkit_1.joinPathFragments)(options.projectRoot, determineTsConfig(tree, options)),
20
- assets: [
21
- (0, devkit_1.joinPathFragments)(options.projectRoot, 'src/favicon.ico'),
22
- (0, devkit_1.joinPathFragments)(options.projectRoot, 'src/assets'),
23
- ],
24
- webpackConfig: (0, devkit_1.joinPathFragments)(options.projectRoot, 'webpack.config.js'),
25
- },
26
- configurations: {
27
- development: {
28
- extractLicenses: false,
29
- optimization: false,
30
- sourceMap: true,
31
- vendorChunk: true,
32
- },
33
- production: {
34
- optimization: true,
35
- outputHashing: 'all',
36
- sourceMap: false,
37
- namedChunks: false,
38
- extractLicenses: true,
39
- vendorChunk: false,
40
- },
41
- },
42
- };
43
- }
44
- function createServeTarget(options) {
45
- return {
46
- executor: '@nx/webpack:dev-server',
47
- defaultConfiguration: 'development',
48
- options: {
49
- buildTarget: `${options.project}:build`,
50
- hmr: true,
51
- },
52
- configurations: {
53
- development: {
54
- buildTarget: `${options.project}:build:development`,
55
- },
56
- production: {
57
- buildTarget: `${options.project}:build:production`,
58
- hmr: false,
59
- },
60
- },
61
- };
62
- }
63
6
  function createNxWebpackPluginOptions(tree, options) {
64
7
  return {
65
8
  target: 'web',
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.webConfigurationGenerator = webConfigurationGenerator;
4
4
  const devkit_1 = require("@nx/devkit");
5
- const internal_1 = require("@nx/react/internal");
5
+ const semver_1 = require("semver");
6
6
  const versions_1 = require("../../utils/versions");
7
7
  const normalize_schema_1 = require("./lib/normalize-schema");
8
8
  const webpack_targets_1 = require("./lib/webpack-targets");
@@ -31,15 +31,19 @@ async function webConfigurationGenerator(tree, options) {
31
31
  tasks.push(...bundlerTasks);
32
32
  // create files for webpack and vite config, index.html
33
33
  if (normalizedSchema.bundler === 'vite') {
34
- (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, './files/base-vite'), normalizedSchema.projectRoot, { ...normalizedSchema, tmpl: '' });
34
+ // resolve.tsconfigPaths is native only from Vite 8; older majors ignore it.
35
+ const installedVite = (0, semver_1.coerce)((0, devkit_1.getDependencyVersionFromPackageJson)(tree, 'vite') ?? '');
36
+ const useNativeTsconfigPaths = !installedVite || (0, semver_1.major)(installedVite) >= 8;
37
+ (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, './files/base-vite'), normalizedSchema.projectRoot, { ...normalizedSchema, useNativeTsconfigPaths, tmpl: '' });
38
+ if (!useNativeTsconfigPaths && !options.skipPackageJson) {
39
+ tasks.push((0, devkit_1.addDependenciesToPackageJson)(tree, {}, { 'vite-tsconfig-paths': versions_1.viteTsconfigPathsVersion }, undefined, true));
40
+ }
35
41
  }
36
42
  else {
37
43
  (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, './files/base-webpack'), normalizedSchema.projectRoot, {
38
44
  ...normalizedSchema,
39
45
  tmpl: '',
40
- webpackPluginOptions: (0, internal_1.hasWebpackPlugin)(tree)
41
- ? (0, webpack_targets_1.createNxWebpackPluginOptions)(tree, normalizedSchema)
42
- : null,
46
+ webpackPluginOptions: (0, webpack_targets_1.createNxWebpackPluginOptions)(tree, normalizedSchema),
43
47
  });
44
48
  }
45
49
  if (!options.skipPackageJson) {
@@ -85,19 +89,6 @@ async function addBundlerConfiguration(tree, normalizedSchema) {
85
89
  const { ensureDependencies, } = require('@nx/webpack/internal');
86
90
  tasks.push(ensureDependencies(tree, { uiFramework: 'react' }));
87
91
  }
88
- if (!(0, internal_1.hasWebpackPlugin)(tree)) {
89
- // Mirrors warnWebpackExecutorGenerating from @nx/webpack/src/utils/deprecation.
90
- // Inlined to avoid a cross-package import where react-native does not
91
- // declare a TypeScript project reference to webpack.
92
- devkit_1.logger.warn('Generating targets that use the deprecated `@nx/webpack:webpack` and `@nx/webpack:dev-server` executors. These executors will be removed in Nx v24. Run `nx g @nx/webpack:convert-to-inferred` next to migrate these targets to the `@nx/webpack/plugin` inferred plugin and prevent future generators from emitting executor targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.');
93
- const projectConfiguration = (0, devkit_1.readProjectConfiguration)(tree, normalizedSchema.project);
94
- projectConfiguration.targets = {
95
- ...projectConfiguration.targets,
96
- build: (0, webpack_targets_1.createBuildTarget)(tree, normalizedSchema),
97
- serve: (0, webpack_targets_1.createServeTarget)(normalizedSchema),
98
- };
99
- (0, devkit_1.updateProjectConfiguration)(tree, normalizedSchema.project, projectConfiguration);
100
- }
101
92
  return tasks;
102
93
  }
103
94
  }
@@ -0,0 +1,12 @@
1
+ # Replace removed @nx/react-native executors with inferred tasks
2
+
3
+ Nx 24 removed `@nx/react-native:build-android`, `@nx/react-native:build-ios`, `@nx/react-native:bundle`, `@nx/react-native:pod-install`, `@nx/react-native:run-android`, `@nx/react-native:run-ios`, `@nx/react-native:start`, `@nx/react-native:upgrade` (including old `@nrwl` aliases).
4
+
5
+ Before changing anything, check for leftover work: a project target, a package.json target or a `targetDefaults` entry still uses a removed executor, or the advisory context reports a conversion error. If none applies, make no changes and stop. Treat each advisory-context item as pending work.
6
+
7
+ 1. Inspect all affected projects and workspace defaults. Repair config-loading errors first. Do not restore executor registrations or install older Nx packages.
8
+ 2. Preserve platform variants, bundle output paths, Metro config and native setup. Keep storybook, sync-deps and ensure-symlink executors. Device validation may be skipped explicitly; graph creation may not.
9
+ 3. Register `@nx/react-native/plugin` with options/includes that preserve custom target names and mixed inferred/explicit projects. Replace remaining removed-executor targets, including those in package.json and filtered targetDefaults. Transfer their behavior before removing obsolete defaults. Preserve configurations, dependencies, cache inputs/outputs and environment behavior. Do not silently delete unsupported options or unrelated targets. Migrate old @nrwl aliases too.
10
+ 4. Run project graph creation with the daemon and graph cache disabled (`NX_DAEMON=false NX_CACHE_PROJECT_GRAPH=false`), using the workspace package manager. Inspect resolved project targets and verify each migrated entrypoint exists and is inferred (a thin alias to an inferred target is acceptable). Resolve graph errors before completing this migration, even if task validation was skipped. Configs must load for subsequent migrations.
11
+ 5. By default run relevant real builds/tests with task cache disabled, including alternate configurations. Honor an existing preference to skip expensive task validation; otherwise offer that option when validation is slow. Skipping expensive tasks never skips conversion or the graph check. Report each skipped task as unverified. Never weaken assertions or change application behavior to make checks pass.
12
+ 6. Report converted projects, graph validation, task results and any skipped checks. Unconverted targets or a broken graph mean the migration is incomplete. Investigate task failures and distinguish missing environment prerequisites from conversion regressions; do not claim a working workspace with unresolved regressions.
@@ -0,0 +1,6 @@
1
+ import type { Tree } from '@nx/devkit';
2
+ export default function update(tree: Tree): Promise<{
3
+ nextSteps?: string[];
4
+ agentContext?: string[];
5
+ skipAgentic?: boolean;
6
+ }>;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = update;
4
+ const internal_1 = require("@nx/devkit/internal");
5
+ function update(tree) {
6
+ return (0, internal_1.migrateRemovedExecutors)(tree, [
7
+ '@nx/react-native:build-android',
8
+ '@nx/react-native:build-ios',
9
+ '@nx/react-native:bundle',
10
+ '@nx/react-native:pod-install',
11
+ '@nx/react-native:run-android',
12
+ '@nx/react-native:run-ios',
13
+ '@nx/react-native:start',
14
+ '@nx/react-native:upgrade',
15
+ '@nrwl/react-native:build-android',
16
+ '@nrwl/react-native:build-ios',
17
+ '@nrwl/react-native:bundle',
18
+ '@nrwl/react-native:pod-install',
19
+ '@nrwl/react-native:run-android',
20
+ '@nrwl/react-native:run-ios',
21
+ '@nrwl/react-native:start',
22
+ '@nrwl/react-native:upgrade',
23
+ ], async (tree, options) => {
24
+ const { convertToInferred } = require('../../generators/convert-to-inferred/convert-to-inferred');
25
+ // The callback only prints the options the converter could not carry
26
+ // over; migrateRemovedExecutors discards it.
27
+ const flushLogs = await convertToInferred(tree, options);
28
+ flushLogs();
29
+ });
30
+ }