@nx/webpack 23.0.0-pr.35465.2bc2643 → 23.0.0-rc.1

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 (233) hide show
  1. package/{app-plugin.d.ts → dist/app-plugin.d.ts} +0 -1
  2. package/{index.d.ts → dist/index.d.ts} +0 -4
  3. package/{index.js → dist/index.js} +1 -4
  4. package/dist/internal.d.ts +8 -0
  5. package/dist/internal.js +26 -0
  6. package/{plugin.d.ts → dist/plugin.d.ts} +0 -1
  7. package/{src → dist/src}/executors/dev-server/dev-server.impl.d.ts +0 -1
  8. package/{src → dist/src}/executors/dev-server/dev-server.impl.js +10 -8
  9. package/{src → dist/src}/executors/dev-server/lib/get-dev-server-config.d.ts +0 -1
  10. package/{src → dist/src}/executors/dev-server/lib/serve-path.d.ts +0 -1
  11. package/{src → dist/src}/executors/dev-server/schema.json +1 -0
  12. package/{src → dist/src}/executors/ssr-dev-server/lib/wait-until-server-is-listening.d.ts +0 -1
  13. package/{src → dist/src}/executors/ssr-dev-server/ssr-dev-server.impl.d.ts +0 -1
  14. package/{src → dist/src}/executors/ssr-dev-server/ssr-dev-server.impl.js +2 -2
  15. package/{src → dist/src}/executors/webpack/lib/normalize-options.d.ts +0 -1
  16. package/{src → dist/src}/executors/webpack/lib/normalize-options.js +2 -2
  17. package/{src → dist/src}/executors/webpack/lib/run-webpack.d.ts +1 -2
  18. package/{src → dist/src}/executors/webpack/lib/run-webpack.js +3 -3
  19. package/{src → dist/src}/executors/webpack/schema.d.ts +1 -1
  20. package/{src → dist/src}/executors/webpack/schema.json +1 -0
  21. package/{src → dist/src}/executors/webpack/webpack.impl.d.ts +0 -1
  22. package/{src → dist/src}/executors/webpack/webpack.impl.js +6 -4
  23. package/{src → dist/src}/generators/configuration/configuration.d.ts +0 -1
  24. package/{src → dist/src}/generators/configuration/configuration.js +9 -2
  25. package/{src → dist/src}/generators/convert-config-to-webpack-plugin/convert-config-to-webpack-plugin.d.ts +0 -1
  26. package/{src → dist/src}/generators/convert-config-to-webpack-plugin/convert-config-to-webpack-plugin.js +5 -3
  27. package/{src → dist/src}/generators/convert-config-to-webpack-plugin/lib/extract-webpack-options.d.ts +0 -1
  28. package/{src → dist/src}/generators/convert-config-to-webpack-plugin/lib/normalize-path-options.d.ts +0 -1
  29. package/{src → dist/src}/generators/convert-config-to-webpack-plugin/lib/utils.d.ts +0 -1
  30. package/{src → dist/src}/generators/convert-config-to-webpack-plugin/lib/validate-project.d.ts +0 -1
  31. package/{src → dist/src}/generators/convert-to-inferred/convert-to-inferred.d.ts +0 -1
  32. package/{src → dist/src}/generators/convert-to-inferred/convert-to-inferred.js +5 -5
  33. package/{src → dist/src}/generators/convert-to-inferred/utils/ast.d.ts +0 -1
  34. package/{src → dist/src}/generators/convert-to-inferred/utils/build-post-target-transformer.d.ts +0 -1
  35. package/{src → dist/src}/generators/convert-to-inferred/utils/build-post-target-transformer.js +8 -8
  36. package/{src → dist/src}/generators/convert-to-inferred/utils/index.d.ts +0 -1
  37. package/{src → dist/src}/generators/convert-to-inferred/utils/serve-post-target-transformer.d.ts +0 -1
  38. package/{src → dist/src}/generators/convert-to-inferred/utils/serve-post-target-transformer.js +4 -4
  39. package/{src → dist/src}/generators/convert-to-inferred/utils/types.d.ts +1 -2
  40. package/{src → dist/src}/generators/init/init.d.ts +0 -1
  41. package/{src → dist/src}/generators/init/init.js +10 -3
  42. package/{src → dist/src}/generators/init/schema.json +1 -1
  43. package/{src → dist/src}/migrations/update-21-0-0/remove-isolated-config.d.ts +0 -1
  44. package/{src → dist/src}/migrations/update-21-0-0/remove-isolated-config.js +2 -2
  45. package/dist/src/migrations/update-21-0-0/remove-isolated-config.md +37 -0
  46. package/{src → dist/src}/migrations/update-22-0-0/remove-deprecated-options.d.ts +0 -1
  47. package/dist/src/migrations/update-23-0-0/migrate-create-nodes-v2-to-create-nodes.d.ts +9 -0
  48. package/dist/src/migrations/update-23-0-0/migrate-create-nodes-v2-to-create-nodes.js +223 -0
  49. package/dist/src/migrations/update-23-0-0/migrate-create-nodes-v2-to-create-nodes.md +25 -0
  50. package/dist/src/migrations/update-23-0-0/remove-nx-tsconfig-paths-webpack-plugin-import.d.ts +2 -0
  51. package/dist/src/migrations/update-23-0-0/remove-nx-tsconfig-paths-webpack-plugin-import.js +128 -0
  52. package/dist/src/migrations/update-23-0-0/remove-nx-tsconfig-paths-webpack-plugin-import.md +54 -0
  53. package/dist/src/migrations/update-23-0-0/rewrite-internal-subpath-imports.d.ts +3 -0
  54. package/dist/src/migrations/update-23-0-0/rewrite-internal-subpath-imports.js +225 -0
  55. package/{src → dist/src}/plugins/generate-package-json-plugin.d.ts +0 -1
  56. package/{src → dist/src}/plugins/nx-typescript-webpack-plugin/nx-tsconfig-paths-webpack-plugin.d.ts +0 -1
  57. package/{src → dist/src}/plugins/nx-typescript-webpack-plugin/nx-tsconfig-paths-webpack-plugin.js +5 -5
  58. package/{src → dist/src}/plugins/nx-webpack-plugin/lib/apply-base-config.d.ts +0 -1
  59. package/{src → dist/src}/plugins/nx-webpack-plugin/lib/apply-base-config.js +2 -2
  60. package/{src → dist/src}/plugins/nx-webpack-plugin/lib/apply-web-config.d.ts +0 -1
  61. package/{src → dist/src}/plugins/nx-webpack-plugin/lib/apply-web-config.js +3 -3
  62. package/{src → dist/src}/plugins/nx-webpack-plugin/lib/compiler-loaders.d.ts +0 -1
  63. package/{src → dist/src}/plugins/nx-webpack-plugin/lib/get-terser-ecma-version.d.ts +0 -1
  64. package/{src → dist/src}/plugins/nx-webpack-plugin/lib/instantiate-script-plugins.d.ts +0 -1
  65. package/{src → dist/src}/plugins/nx-webpack-plugin/lib/normalize-options.d.ts +0 -1
  66. package/{src → dist/src}/plugins/nx-webpack-plugin/lib/normalize-options.js +2 -2
  67. package/{src → dist/src}/plugins/nx-webpack-plugin/lib/stylesheet-loaders.d.ts +0 -1
  68. package/{src → dist/src}/plugins/nx-webpack-plugin/lib/utils.d.ts +0 -1
  69. package/{src → dist/src}/plugins/nx-webpack-plugin/nx-app-webpack-plugin-options.d.ts +1 -2
  70. package/{src → dist/src}/plugins/nx-webpack-plugin/nx-app-webpack-plugin.d.ts +0 -1
  71. package/{src → dist/src}/plugins/plugin.d.ts +3 -4
  72. package/{src → dist/src}/plugins/plugin.js +62 -29
  73. package/{src → dist/src}/plugins/stats-json-plugin.d.ts +0 -1
  74. package/{src → dist/src}/plugins/use-legacy-nx-plugin/use-legacy-nx-plugin.d.ts +0 -1
  75. package/{src → dist/src}/plugins/webpack-nx-build-coordination-plugin.d.ts +0 -1
  76. package/{src → dist/src}/plugins/write-index-html-plugin.d.ts +0 -1
  77. package/{src → dist/src}/utils/config.d.ts +12 -1
  78. package/{src → dist/src}/utils/config.js +17 -2
  79. package/{src → dist/src}/utils/create-copy-plugin.d.ts +0 -1
  80. package/dist/src/utils/deprecation.d.ts +8 -0
  81. package/dist/src/utils/deprecation.js +55 -0
  82. package/dist/src/utils/e2e-web-server-info-utils.d.ts +2 -0
  83. package/{src → dist/src}/utils/e2e-web-server-info-utils.js +6 -5
  84. package/{src → dist/src}/utils/ensure-dependencies.d.ts +0 -1
  85. package/{src → dist/src}/utils/ensure-dependencies.js +3 -3
  86. package/{src → dist/src}/utils/fs.d.ts +0 -1
  87. package/{src → dist/src}/utils/get-client-environment.d.ts +0 -1
  88. package/{src → dist/src}/utils/get-css-module-local-ident.d.ts +0 -1
  89. package/{src → dist/src}/utils/has-plugin.d.ts +0 -1
  90. package/{src → dist/src}/utils/hash-format.d.ts +0 -1
  91. package/{src → dist/src}/utils/models.d.ts +0 -1
  92. package/{src → dist/src}/utils/run-webpack.d.ts +0 -1
  93. package/dist/src/utils/versions.d.ts +12 -0
  94. package/dist/src/utils/versions.js +24 -0
  95. package/dist/src/utils/web-babel-loader.d.ts +1 -0
  96. package/{src → dist/src}/utils/web-babel-loader.js +2 -0
  97. package/dist/src/utils/webpack/deprecated-less-loader.js +19 -0
  98. package/{src → dist/src}/utils/webpack/interpolate-env-variables-to-index.d.ts +0 -1
  99. package/{src → dist/src}/utils/webpack/normalize-entry.d.ts +0 -1
  100. package/{src → dist/src}/utils/webpack/package-chunk-sort.d.ts +0 -1
  101. package/{src → dist/src}/utils/webpack/plugins/postcss-cli-resources.d.ts +0 -1
  102. package/{src → dist/src}/utils/webpack/plugins/scripts-webpack-plugin.d.ts +0 -1
  103. package/{src → dist/src}/utils/webpack/read-webpack-options.d.ts +0 -1
  104. package/{src → dist/src}/utils/webpack/resolve-user-defined-webpack-config.d.ts +0 -1
  105. package/{src → dist/src}/utils/webpack/resolve-user-defined-webpack-config.js +4 -6
  106. package/{src → dist/src}/utils/with-nx.d.ts +4 -1
  107. package/{src → dist/src}/utils/with-nx.js +6 -0
  108. package/{src → dist/src}/utils/with-web.d.ts +4 -1
  109. package/{src → dist/src}/utils/with-web.js +6 -0
  110. package/{tsconfig-paths-plugin.d.ts → dist/tsconfig-paths-plugin.d.ts} +0 -1
  111. package/executors.json +6 -6
  112. package/generators.json +8 -8
  113. package/migrations.json +34 -20
  114. package/package.json +85 -16
  115. package/app-plugin.d.ts.map +0 -1
  116. package/index.d.ts.map +0 -1
  117. package/plugin.d.ts.map +0 -1
  118. package/src/executors/dev-server/dev-server.impl.d.ts.map +0 -1
  119. package/src/executors/dev-server/lib/get-dev-server-config.d.ts.map +0 -1
  120. package/src/executors/dev-server/lib/serve-path.d.ts.map +0 -1
  121. package/src/executors/ssr-dev-server/lib/wait-until-server-is-listening.d.ts.map +0 -1
  122. package/src/executors/ssr-dev-server/ssr-dev-server.impl.d.ts.map +0 -1
  123. package/src/executors/webpack/lib/normalize-options.d.ts.map +0 -1
  124. package/src/executors/webpack/lib/run-webpack.d.ts.map +0 -1
  125. package/src/executors/webpack/webpack.impl.d.ts.map +0 -1
  126. package/src/generators/configuration/configuration.d.ts.map +0 -1
  127. package/src/generators/convert-config-to-webpack-plugin/convert-config-to-webpack-plugin.d.ts.map +0 -1
  128. package/src/generators/convert-config-to-webpack-plugin/lib/extract-webpack-options.d.ts.map +0 -1
  129. package/src/generators/convert-config-to-webpack-plugin/lib/normalize-path-options.d.ts.map +0 -1
  130. package/src/generators/convert-config-to-webpack-plugin/lib/utils.d.ts.map +0 -1
  131. package/src/generators/convert-config-to-webpack-plugin/lib/validate-project.d.ts.map +0 -1
  132. package/src/generators/convert-to-inferred/convert-to-inferred.d.ts.map +0 -1
  133. package/src/generators/convert-to-inferred/utils/ast.d.ts.map +0 -1
  134. package/src/generators/convert-to-inferred/utils/build-post-target-transformer.d.ts.map +0 -1
  135. package/src/generators/convert-to-inferred/utils/index.d.ts.map +0 -1
  136. package/src/generators/convert-to-inferred/utils/serve-post-target-transformer.d.ts.map +0 -1
  137. package/src/generators/convert-to-inferred/utils/types.d.ts.map +0 -1
  138. package/src/generators/init/init.d.ts.map +0 -1
  139. package/src/migrations/update-21-0-0/remove-isolated-config.d.ts.map +0 -1
  140. package/src/migrations/update-22-0-0/remove-deprecated-options.d.ts.map +0 -1
  141. package/src/plugins/generate-package-json-plugin.d.ts.map +0 -1
  142. package/src/plugins/nx-typescript-webpack-plugin/nx-tsconfig-paths-webpack-plugin.d.ts.map +0 -1
  143. package/src/plugins/nx-webpack-plugin/lib/apply-base-config.d.ts.map +0 -1
  144. package/src/plugins/nx-webpack-plugin/lib/apply-web-config.d.ts.map +0 -1
  145. package/src/plugins/nx-webpack-plugin/lib/compiler-loaders.d.ts.map +0 -1
  146. package/src/plugins/nx-webpack-plugin/lib/get-terser-ecma-version.d.ts.map +0 -1
  147. package/src/plugins/nx-webpack-plugin/lib/instantiate-script-plugins.d.ts.map +0 -1
  148. package/src/plugins/nx-webpack-plugin/lib/normalize-options.d.ts.map +0 -1
  149. package/src/plugins/nx-webpack-plugin/lib/stylesheet-loaders.d.ts.map +0 -1
  150. package/src/plugins/nx-webpack-plugin/lib/utils.d.ts.map +0 -1
  151. package/src/plugins/nx-webpack-plugin/nx-app-webpack-plugin-options.d.ts.map +0 -1
  152. package/src/plugins/nx-webpack-plugin/nx-app-webpack-plugin.d.ts.map +0 -1
  153. package/src/plugins/plugin.d.ts.map +0 -1
  154. package/src/plugins/stats-json-plugin.d.ts.map +0 -1
  155. package/src/plugins/use-legacy-nx-plugin/use-legacy-nx-plugin.d.ts.map +0 -1
  156. package/src/plugins/webpack-nx-build-coordination-plugin.d.ts.map +0 -1
  157. package/src/plugins/write-index-html-plugin.d.ts.map +0 -1
  158. package/src/utils/config.d.ts.map +0 -1
  159. package/src/utils/create-copy-plugin.d.ts.map +0 -1
  160. package/src/utils/e2e-web-server-info-utils.d.ts +0 -3
  161. package/src/utils/e2e-web-server-info-utils.d.ts.map +0 -1
  162. package/src/utils/ensure-dependencies.d.ts.map +0 -1
  163. package/src/utils/fs.d.ts.map +0 -1
  164. package/src/utils/get-client-environment.d.ts.map +0 -1
  165. package/src/utils/get-css-module-local-ident.d.ts.map +0 -1
  166. package/src/utils/has-plugin.d.ts.map +0 -1
  167. package/src/utils/hash-format.d.ts.map +0 -1
  168. package/src/utils/models.d.ts.map +0 -1
  169. package/src/utils/run-webpack.d.ts.map +0 -1
  170. package/src/utils/versions.d.ts +0 -8
  171. package/src/utils/versions.d.ts.map +0 -1
  172. package/src/utils/versions.js +0 -11
  173. package/src/utils/web-babel-loader.d.ts +0 -1
  174. package/src/utils/web-babel-loader.d.ts.map +0 -1
  175. package/src/utils/webpack/interpolate-env-variables-to-index.d.ts.map +0 -1
  176. package/src/utils/webpack/normalize-entry.d.ts.map +0 -1
  177. package/src/utils/webpack/package-chunk-sort.d.ts.map +0 -1
  178. package/src/utils/webpack/plugins/postcss-cli-resources.d.ts.map +0 -1
  179. package/src/utils/webpack/plugins/scripts-webpack-plugin.d.ts.map +0 -1
  180. package/src/utils/webpack/read-webpack-options.d.ts.map +0 -1
  181. package/src/utils/webpack/resolve-user-defined-webpack-config.d.ts.map +0 -1
  182. package/src/utils/with-nx.d.ts.map +0 -1
  183. package/src/utils/with-web.d.ts.map +0 -1
  184. package/tsconfig-paths-plugin.d.ts.map +0 -1
  185. /package/{LICENSE → dist/LICENSE} +0 -0
  186. /package/{app-plugin.js → dist/app-plugin.js} +0 -0
  187. /package/{plugin.js → dist/plugin.js} +0 -0
  188. /package/{src → dist/src}/executors/dev-server/lib/get-dev-server-config.js +0 -0
  189. /package/{src → dist/src}/executors/dev-server/lib/serve-path.js +0 -0
  190. /package/{src → dist/src}/executors/dev-server/schema.d.ts +0 -0
  191. /package/{src → dist/src}/executors/ssr-dev-server/lib/wait-until-server-is-listening.js +0 -0
  192. /package/{src → dist/src}/executors/ssr-dev-server/schema.d.ts +0 -0
  193. /package/{src → dist/src}/executors/ssr-dev-server/schema.json +0 -0
  194. /package/{src → dist/src}/generators/configuration/schema.d.ts +0 -0
  195. /package/{src → dist/src}/generators/configuration/schema.json +0 -0
  196. /package/{src → dist/src}/generators/convert-config-to-webpack-plugin/lib/extract-webpack-options.js +0 -0
  197. /package/{src → dist/src}/generators/convert-config-to-webpack-plugin/lib/normalize-path-options.js +0 -0
  198. /package/{src → dist/src}/generators/convert-config-to-webpack-plugin/lib/utils.js +0 -0
  199. /package/{src → dist/src}/generators/convert-config-to-webpack-plugin/lib/validate-project.js +0 -0
  200. /package/{src → dist/src}/generators/convert-config-to-webpack-plugin/schema.json +0 -0
  201. /package/{src → dist/src}/generators/convert-to-inferred/schema.json +0 -0
  202. /package/{src → dist/src}/generators/convert-to-inferred/utils/ast.js +0 -0
  203. /package/{src → dist/src}/generators/convert-to-inferred/utils/index.js +0 -0
  204. /package/{src → dist/src}/generators/convert-to-inferred/utils/types.js +0 -0
  205. /package/{src → dist/src}/generators/init/schema.d.ts +0 -0
  206. /package/{src → dist/src}/migrations/update-22-0-0/remove-deprecated-options.js +0 -0
  207. /package/{src → dist/src}/plugins/generate-package-json-plugin.js +0 -0
  208. /package/{src → dist/src}/plugins/nx-webpack-plugin/lib/compiler-loaders.js +0 -0
  209. /package/{src → dist/src}/plugins/nx-webpack-plugin/lib/get-terser-ecma-version.js +0 -0
  210. /package/{src → dist/src}/plugins/nx-webpack-plugin/lib/instantiate-script-plugins.js +0 -0
  211. /package/{src → dist/src}/plugins/nx-webpack-plugin/lib/stylesheet-loaders.js +0 -0
  212. /package/{src → dist/src}/plugins/nx-webpack-plugin/lib/utils.js +0 -0
  213. /package/{src → dist/src}/plugins/nx-webpack-plugin/nx-app-webpack-plugin-options.js +0 -0
  214. /package/{src → dist/src}/plugins/nx-webpack-plugin/nx-app-webpack-plugin.js +0 -0
  215. /package/{src → dist/src}/plugins/stats-json-plugin.js +0 -0
  216. /package/{src → dist/src}/plugins/use-legacy-nx-plugin/use-legacy-nx-plugin.js +0 -0
  217. /package/{src → dist/src}/plugins/webpack-nx-build-coordination-plugin.js +0 -0
  218. /package/{src → dist/src}/plugins/write-index-html-plugin.js +0 -0
  219. /package/{src → dist/src}/utils/create-copy-plugin.js +0 -0
  220. /package/{src → dist/src}/utils/fs.js +0 -0
  221. /package/{src → dist/src}/utils/get-client-environment.js +0 -0
  222. /package/{src → dist/src}/utils/get-css-module-local-ident.js +0 -0
  223. /package/{src → dist/src}/utils/has-plugin.js +0 -0
  224. /package/{src → dist/src}/utils/hash-format.js +0 -0
  225. /package/{src → dist/src}/utils/models.js +0 -0
  226. /package/{src → dist/src}/utils/run-webpack.js +0 -0
  227. /package/{src → dist/src}/utils/webpack/interpolate-env-variables-to-index.js +0 -0
  228. /package/{src → dist/src}/utils/webpack/normalize-entry.js +0 -0
  229. /package/{src → dist/src}/utils/webpack/package-chunk-sort.js +0 -0
  230. /package/{src → dist/src}/utils/webpack/plugins/postcss-cli-resources.js +0 -0
  231. /package/{src → dist/src}/utils/webpack/plugins/scripts-webpack-plugin.js +0 -0
  232. /package/{src → dist/src}/utils/webpack/read-webpack-options.js +0 -0
  233. /package/{tsconfig-paths-plugin.js → dist/tsconfig-paths-plugin.js} +0 -0
@@ -2,20 +2,21 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.webpackInitGenerator = webpackInitGenerator;
4
4
  exports.webpackInitGeneratorInternal = webpackInitGeneratorInternal;
5
+ const internal_1 = require("@nx/devkit/internal");
5
6
  const devkit_1 = require("@nx/devkit");
6
- const add_plugin_1 = require("@nx/devkit/src/utils/add-plugin");
7
7
  const plugin_1 = require("../../plugins/plugin");
8
8
  const versions_1 = require("../../utils/versions");
9
9
  function webpackInitGenerator(tree, schema) {
10
10
  return webpackInitGeneratorInternal(tree, { addPlugin: false, ...schema });
11
11
  }
12
12
  async function webpackInitGeneratorInternal(tree, schema) {
13
+ (0, versions_1.assertSupportedWebpackVersion)(tree);
13
14
  const nxJson = (0, devkit_1.readNxJson)(tree);
14
15
  const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' &&
15
16
  nxJson.useInferencePlugins !== false;
16
17
  schema.addPlugin ??= addPluginDefault;
17
18
  if (schema.addPlugin) {
18
- await (0, add_plugin_1.addPlugin)(tree, await (0, devkit_1.createProjectGraphAsync)(), '@nx/webpack/plugin', plugin_1.createNodesV2, {
19
+ await (0, internal_1.addPlugin)(tree, await (0, devkit_1.createProjectGraphAsync)(), '@nx/webpack/plugin', plugin_1.createNodesV2, {
19
20
  buildTargetName: [
20
21
  'build',
21
22
  'webpack:build',
@@ -58,14 +59,20 @@ async function webpackInitGeneratorInternal(tree, schema) {
58
59
  }
59
60
  let installTask = () => { };
60
61
  if (!schema.skipPackageJson) {
62
+ // webpack and webpack-dev-server are peer dependencies, so ensure they are
63
+ // installed (both the executor and inferred-plugin paths need them at the
64
+ // user's runtime).
61
65
  const devDependencies = {
62
66
  '@nx/webpack': versions_1.nxVersion,
63
67
  '@nx/web': versions_1.nxVersion,
68
+ webpack: versions_1.webpackVersion,
69
+ 'webpack-dev-server': versions_1.webpackDevServerVersion,
64
70
  };
65
71
  if (schema.addPlugin) {
72
+ // The inferred plugin runs the `webpack-cli` binary.
66
73
  devDependencies['webpack-cli'] = versions_1.webpackCliVersion;
67
74
  }
68
- installTask = (0, devkit_1.addDependenciesToPackageJson)(tree, {}, devDependencies, undefined, schema.keepExistingVersions);
75
+ installTask = (0, devkit_1.addDependenciesToPackageJson)(tree, {}, devDependencies, undefined, schema.keepExistingVersions ?? true);
69
76
  }
70
77
  if (!schema.skipFormat) {
71
78
  await (0, devkit_1.formatFiles)(tree);
@@ -20,7 +20,7 @@
20
20
  "type": "boolean",
21
21
  "x-priority": "internal",
22
22
  "description": "Keep existing dependencies versions",
23
- "default": false
23
+ "default": true
24
24
  },
25
25
  "updatePackageScripts": {
26
26
  "type": "boolean",
@@ -1,3 +1,2 @@
1
1
  import { Tree } from '@nx/devkit';
2
2
  export default function (tree: Tree): Promise<void>;
3
- //# sourceMappingURL=remove-isolated-config.d.ts.map
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = default_1;
4
+ const internal_1 = require("@nx/devkit/internal");
4
5
  const devkit_1 = require("@nx/devkit");
5
- const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
6
6
  async function default_1(tree) {
7
- (0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nx/webpack:webpack', (options, projectName, targetName, configurationName) => {
7
+ (0, internal_1.forEachExecutorOptions)(tree, '@nx/webpack:webpack', (options, projectName, targetName, configurationName) => {
8
8
  // Only handle webpack config for default configuration
9
9
  if (configurationName)
10
10
  return;
@@ -0,0 +1,37 @@
1
+ #### Remove `isolatedConfig` option
2
+
3
+ The `isolatedConfig` option is no longer supported by the `@nx/webpack:webpack` executor. Previously, setting `isolatedConfig: false` allowed you to use the executor's built-in Webpack configuration.
4
+
5
+ If this option is set in `project.json`, then it will be removed in favor of an explicit `webpackConfig` file. The Webpack configuration file matches the previous built-in configuration of the `@nx/webpack:webpack` executor.
6
+
7
+ #### Sample Code Changes
8
+
9
+ ##### Before
10
+
11
+ ```json title="project.json"
12
+ {
13
+ "targets": {
14
+ "build": {
15
+ "executor": "@nx/webpack:webpack",
16
+ "options": {
17
+ "isolatedConfig": false
18
+ }
19
+ }
20
+ }
21
+ }
22
+ ```
23
+
24
+ ##### After
25
+
26
+ ```json title="project.json" {6}
27
+ {
28
+ "targets": {
29
+ "build": {
30
+ "executor": "@nx/webpack:webpack",
31
+ "options": {
32
+ "webpackConfig": "apps/myapp/webpack.config.js"
33
+ }
34
+ }
35
+ }
36
+ }
37
+ ```
@@ -1,3 +1,2 @@
1
1
  import { Tree } from '@nx/devkit';
2
2
  export default function (tree: Tree): Promise<void>;
3
- //# sourceMappingURL=remove-deprecated-options.d.ts.map
@@ -0,0 +1,9 @@
1
+ import { type Tree } from '@nx/devkit';
2
+ export default function migrateCreateNodesV2ToCreateNodes(tree: Tree): Promise<void>;
3
+ /**
4
+ * Rewrites named imports and re-exports of `createNodesV2` to `createNodes`
5
+ * when they come from one of the given module specifiers. Only the named
6
+ * bindings are touched — the module specifier, the `import`/`export` keyword,
7
+ * any `type` modifier, and any default import are left untouched.
8
+ */
9
+ export declare function rewriteCreateNodesV2Imports(source: string, specifiers: ReadonlySet<string>): string;
@@ -0,0 +1,223 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = migrateCreateNodesV2ToCreateNodes;
4
+ exports.rewriteCreateNodesV2Imports = rewriteCreateNodesV2Imports;
5
+ const devkit_1 = require("@nx/devkit");
6
+ const TS_EXTENSIONS = ['.ts', '.tsx', '.cts', '.mts'];
7
+ const DEPRECATED_NAME = 'createNodesV2';
8
+ const CANONICAL_NAME = 'createNodes';
9
+ // Module specifiers from which `@nx/webpack` publicly exposes `createNodesV2`.
10
+ // A named import or re-export of `createNodesV2` from one of these is rewritten
11
+ // to the canonical `createNodes` export.
12
+ const TARGET_SPECIFIERS = new Set(['@nx/webpack/plugin']);
13
+ let ts;
14
+ async function migrateCreateNodesV2ToCreateNodes(tree) {
15
+ let touchedCount = 0;
16
+ (0, devkit_1.visitNotIgnoredFiles)(tree, '.', (filePath) => {
17
+ if (!TS_EXTENSIONS.some((ext) => filePath.endsWith(ext))) {
18
+ return;
19
+ }
20
+ const original = tree.read(filePath, 'utf-8');
21
+ if (!original || !original.includes(DEPRECATED_NAME)) {
22
+ return;
23
+ }
24
+ const updated = rewriteCreateNodesV2Imports(original, TARGET_SPECIFIERS);
25
+ if (updated !== original) {
26
+ tree.write(filePath, updated);
27
+ touchedCount += 1;
28
+ }
29
+ });
30
+ if (touchedCount > 0) {
31
+ devkit_1.logger.info(`Renamed \`${DEPRECATED_NAME}\` imports to \`${CANONICAL_NAME}\` in ${touchedCount} file(s).`);
32
+ }
33
+ await (0, devkit_1.formatFiles)(tree);
34
+ }
35
+ /**
36
+ * Rewrites named imports and re-exports of `createNodesV2` to `createNodes`
37
+ * when they come from one of the given module specifiers. Only the named
38
+ * bindings are touched — the module specifier, the `import`/`export` keyword,
39
+ * any `type` modifier, and any default import are left untouched.
40
+ */
41
+ function rewriteCreateNodesV2Imports(source, specifiers) {
42
+ ts ??= (0, devkit_1.ensurePackage)('typescript', '*');
43
+ const sourceFile = ts.createSourceFile('tmp.ts', source, ts.ScriptTarget.Latest,
44
+ /* setParentNodes */ true, ts.ScriptKind.TSX);
45
+ const changes = [];
46
+ let renameLocalUsages = false;
47
+ for (const stmt of sourceFile.statements) {
48
+ if (ts.isImportDeclaration(stmt)) {
49
+ renameLocalUsages =
50
+ collectImportRewrite(sourceFile, stmt, specifiers, changes) ||
51
+ renameLocalUsages;
52
+ }
53
+ else if (ts.isExportDeclaration(stmt)) {
54
+ collectExportRewrite(sourceFile, stmt, specifiers, changes);
55
+ }
56
+ }
57
+ // Renaming a local `createNodesV2` import binding to `createNodes` (a lone
58
+ // `{ createNodesV2 }`, or one deduped against an existing `createNodes`)
59
+ // changes the name in scope, so value references to `createNodesV2` in the
60
+ // file body must be renamed too — otherwise they dangle. Aliased imports and
61
+ // re-exports keep their local name, so they never trigger this.
62
+ if (renameLocalUsages) {
63
+ collectValueUsageRewrites(sourceFile, changes);
64
+ }
65
+ return changes.length > 0 ? (0, devkit_1.applyChangesToString)(source, changes) : source;
66
+ }
67
+ function isTargetSpecifier(node, specifiers) {
68
+ return ts.isStringLiteral(node) && specifiers.has(node.text);
69
+ }
70
+ function collectImportRewrite(sourceFile, stmt, specifiers, changes) {
71
+ if (!isTargetSpecifier(stmt.moduleSpecifier, specifiers)) {
72
+ return false;
73
+ }
74
+ const namedBindings = stmt.importClause?.namedBindings;
75
+ // Only `import { ... }` carries renameable named bindings. `import x`,
76
+ // `import * as ns`, and side-effect imports reference the module wholesale
77
+ // and keep working through the `createNodesV2` runtime alias, so we leave
78
+ // them be. A mixed `import def, { createNodesV2 }` still has its named
79
+ // bindings rewritten below — the default binding is untouched.
80
+ if (!namedBindings || !ts.isNamedImports(namedBindings)) {
81
+ return false;
82
+ }
83
+ // The local `createNodesV2` binding only disappears when it is imported
84
+ // without an alias — a lone `{ createNodesV2 }` or one deduped against an
85
+ // existing `createNodes`. `{ createNodesV2 as x }` keeps the local `x`, so
86
+ // its in-file usages are unaffected and must not be rewritten.
87
+ const localBindingRenamed = namedBindings.elements.some((el) => el.name.text === DEPRECATED_NAME &&
88
+ (el.propertyName ?? el.name).text === DEPRECATED_NAME);
89
+ rewriteNamedBindings(sourceFile, namedBindings, changes);
90
+ return localBindingRenamed;
91
+ }
92
+ function collectExportRewrite(sourceFile, stmt, specifiers, changes) {
93
+ if (!stmt.moduleSpecifier ||
94
+ !isTargetSpecifier(stmt.moduleSpecifier, specifiers)) {
95
+ return;
96
+ }
97
+ // `export { ... } from '...'` can be rewritten; `export * from '...'` has no
98
+ // named bindings to rename.
99
+ if (!stmt.exportClause || !ts.isNamedExports(stmt.exportClause)) {
100
+ return;
101
+ }
102
+ rewriteNamedBindings(sourceFile, stmt.exportClause, changes);
103
+ }
104
+ /**
105
+ * Re-renders the `{ ... }` of a named import/export, renaming any
106
+ * `createNodesV2` specifier to `createNodes`. If renaming would collide with a
107
+ * `createNodes` that is already present (e.g. `{ createNodes, createNodesV2 }`),
108
+ * the duplicate is dropped. Returns without recording a change when the binding
109
+ * list contains no `createNodesV2`.
110
+ */
111
+ function rewriteNamedBindings(sourceFile, namedBindings, changes) {
112
+ const elements = namedBindings.elements;
113
+ const hasDeprecated = elements.some((el) => (el.propertyName ?? el.name).text === DEPRECATED_NAME);
114
+ if (!hasDeprecated) {
115
+ return;
116
+ }
117
+ const seen = new Set();
118
+ const rendered = [];
119
+ for (const el of elements) {
120
+ const text = renderSpecifier(el);
121
+ if (!seen.has(text)) {
122
+ seen.add(text);
123
+ rendered.push(text);
124
+ }
125
+ }
126
+ const start = namedBindings.getStart(sourceFile);
127
+ changes.push({
128
+ type: devkit_1.ChangeType.Delete,
129
+ start,
130
+ length: namedBindings.getEnd() - start,
131
+ }, {
132
+ type: devkit_1.ChangeType.Insert,
133
+ index: start,
134
+ text: `{ ${rendered.join(', ')} }`,
135
+ });
136
+ }
137
+ function renderSpecifier(el) {
138
+ const typePrefix = el.isTypeOnly ? 'type ' : '';
139
+ const rename = (name) => name === DEPRECATED_NAME ? CANONICAL_NAME : name;
140
+ // `{ name }` — no alias, so the local binding follows the rename.
141
+ if (!el.propertyName) {
142
+ return `${typePrefix}${rename(el.name.text)}`;
143
+ }
144
+ // `{ propertyName as name }` — only the imported (left) side is renamed; the
145
+ // local alias is preserved. A now-redundant alias such as
146
+ // `createNodesV2 as createNodes` collapses to `createNodes`.
147
+ const canonicalImported = rename(el.propertyName.text);
148
+ const localName = el.name.text;
149
+ return canonicalImported === localName
150
+ ? `${typePrefix}${localName}`
151
+ : `${typePrefix}${canonicalImported} as ${localName}`;
152
+ }
153
+ /**
154
+ * Renames value references of `createNodesV2` to `createNodes` in the file
155
+ * body. Only called once a local `createNodesV2` import binding has actually
156
+ * been renamed, so these references would otherwise dangle. Occurrences that
157
+ * are not references to that binding are skipped: the import/export
158
+ * declarations themselves, property accesses (`x.createNodesV2`), qualified
159
+ * type names, object-literal keys, and declaration names that shadow the
160
+ * import. A shorthand property (`{ createNodesV2 }`) is expanded to
161
+ * `{ createNodesV2: createNodes }` so the property key is preserved. Strings
162
+ * and comments are never `Identifier` nodes, so they are left alone.
163
+ */
164
+ function collectValueUsageRewrites(sourceFile, changes) {
165
+ const visit = (node) => {
166
+ if (ts.isIdentifier(node) &&
167
+ node.text === DEPRECATED_NAME &&
168
+ isRenamableValueUsage(node)) {
169
+ const start = node.getStart(sourceFile);
170
+ changes.push({
171
+ type: devkit_1.ChangeType.Delete,
172
+ start,
173
+ length: node.getEnd() - start,
174
+ }, {
175
+ type: devkit_1.ChangeType.Insert,
176
+ index: start,
177
+ text: ts.isShorthandPropertyAssignment(node.parent)
178
+ ? `${DEPRECATED_NAME}: ${CANONICAL_NAME}`
179
+ : CANONICAL_NAME,
180
+ });
181
+ }
182
+ node.forEachChild(visit);
183
+ };
184
+ sourceFile.forEachChild(visit);
185
+ }
186
+ /**
187
+ * Whether a `createNodesV2` identifier is a value reference to the renamed
188
+ * import binding, as opposed to a position that must be left untouched.
189
+ */
190
+ function isRenamableValueUsage(node) {
191
+ const parent = node.parent;
192
+ if (!parent) {
193
+ return false;
194
+ }
195
+ // Import/export bindings — already handled by the declaration rewrite.
196
+ if (ts.isImportSpecifier(parent) ||
197
+ ts.isExportSpecifier(parent) ||
198
+ ts.isImportClause(parent) ||
199
+ ts.isNamespaceImport(parent)) {
200
+ return false;
201
+ }
202
+ // `x.createNodesV2` / `X.createNodesV2` — a member name, not the binding.
203
+ if (ts.isPropertyAccessExpression(parent) && parent.name === node) {
204
+ return false;
205
+ }
206
+ if (ts.isQualifiedName(parent) && parent.right === node) {
207
+ return false;
208
+ }
209
+ // `{ createNodesV2: ... }` — an object-literal key, not the binding.
210
+ if (ts.isPropertyAssignment(parent) && parent.name === node) {
211
+ return false;
212
+ }
213
+ // A declaration whose name shadows the import (variable, param, etc.).
214
+ if ((ts.isVariableDeclaration(parent) ||
215
+ ts.isParameter(parent) ||
216
+ ts.isBindingElement(parent) ||
217
+ ts.isFunctionDeclaration(parent) ||
218
+ ts.isClassDeclaration(parent)) &&
219
+ parent.name === node) {
220
+ return false;
221
+ }
222
+ return true;
223
+ }
@@ -0,0 +1,25 @@
1
+ #### Rename `createNodesV2` imports to `createNodes`
2
+
3
+ `@nx/webpack` renamed its primary inferred-plugin export from `createNodesV2` to `createNodes`. The `createNodesV2` name is preserved as a deprecated alias for now, but new code should use `createNodes`.
4
+
5
+ This migration scans every `.ts`, `.tsx`, `.cts`, and `.mts` file in your workspace and rewrites named imports and re-exports of `createNodesV2` from `@nx/webpack/plugin` to `createNodes`.
6
+
7
+ #### Sample Code Changes
8
+
9
+ ##### Before
10
+
11
+ ```ts
12
+ import { createNodesV2 } from '@nx/webpack/plugin';
13
+ ```
14
+
15
+ ##### After
16
+
17
+ ```ts
18
+ import { createNodes } from '@nx/webpack/plugin';
19
+ ```
20
+
21
+ Aliases are preserved (`createNodesV2 as cn` becomes `createNodes as cn`), and if a file already imports both names (`{ createNodes, createNodesV2 }`) the redundant binding is dropped.
22
+
23
+ #### What is not rewritten
24
+
25
+ Only static `import`/`export` named bindings from `@nx/webpack/plugin` are rewritten. Namespace imports, dynamic `import(...)`, `require(...)` destructuring, and property access such as `plugin.createNodesV2` are left untouched — they keep working through the `createNodesV2` runtime alias. Update those by hand if you want to drop the deprecated name everywhere.
@@ -0,0 +1,2 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export default function removeNxTsconfigPathsWebpackPluginImport(tree: Tree): Promise<void>;
@@ -0,0 +1,128 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = removeNxTsconfigPathsWebpackPluginImport;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const tsquery_1 = require("@phenomnomnominal/tsquery");
6
+ const DEPRECATED_SYMBOL = 'NxTsconfigPathsWebpackPlugin';
7
+ const DEPRECATED_PACKAGE = '@nx/webpack';
8
+ const NEW_PACKAGE = '@nx/webpack/tsconfig-paths-plugin';
9
+ // ES module import: import { NxTsconfigPathsWebpackPlugin[, ...] } from '@nx/webpack'
10
+ const ES_IMPORT_SELECTOR = `ImportDeclaration:has(StringLiteral[value=${DEPRECATED_PACKAGE}]):has(ImportClause ImportSpecifier > Identifier[name=${DEPRECATED_SYMBOL}])`;
11
+ const IMPORT_SPECIFIERS_SELECTOR = `ImportClause ImportSpecifier`;
12
+ const TARGET_IMPORT_SPECIFIER_SELECTOR = `ImportClause ImportSpecifier > Identifier[name=${DEPRECATED_SYMBOL}]`;
13
+ const ES_MODULE_PATH_SELECTOR = `StringLiteral[value=${DEPRECATED_PACKAGE}]`;
14
+ // CJS require: const { NxTsconfigPathsWebpackPlugin[, ...] } = require('@nx/webpack')
15
+ const CJS_REQUIRE_STMT_SELECTOR = `VariableStatement:has(ObjectBindingPattern > BindingElement > Identifier[name=${DEPRECATED_SYMBOL}]):has(CallExpression:has(Identifier[name=require]) > StringLiteral[value=${DEPRECATED_PACKAGE}])`;
16
+ const CJS_BINDING_ELEMENTS_SELECTOR = `ObjectBindingPattern > BindingElement`;
17
+ const CJS_TARGET_BINDING_SELECTOR = `ObjectBindingPattern > BindingElement > Identifier[name=${DEPRECATED_SYMBOL}]`;
18
+ const CJS_REQUIRE_PATH_SELECTOR = `CallExpression:has(Identifier[name=require]) > StringLiteral[value=${DEPRECATED_PACKAGE}]`;
19
+ // Walk past whitespace from `fromIndex` to find a trailing comma. Returns the
20
+ // position AFTER the comma if found, otherwise the original index. Handles
21
+ // the `Foo , withReact` shape where the user wrote whitespace before the
22
+ // comma — `node.getEnd()` stops at the identifier and the comma sits one
23
+ // character past the whitespace.
24
+ function endAfterTrailingComma(text, fromIndex) {
25
+ let i = fromIndex;
26
+ while (i < text.length && /\s/.test(text.charAt(i)))
27
+ i++;
28
+ return text.charAt(i) === ',' ? i + 1 : fromIndex;
29
+ }
30
+ async function removeNxTsconfigPathsWebpackPluginImport(tree) {
31
+ (0, devkit_1.visitNotIgnoredFiles)(tree, '', (filePath) => {
32
+ if (!filePath.endsWith('.ts') &&
33
+ !filePath.endsWith('.tsx') &&
34
+ !filePath.endsWith('.js') &&
35
+ !filePath.endsWith('.jsx') &&
36
+ !filePath.endsWith('.cjs') &&
37
+ !filePath.endsWith('.mjs')) {
38
+ return;
39
+ }
40
+ let contents = tree.read(filePath, 'utf-8');
41
+ if (!contents)
42
+ return;
43
+ // Quick check: must contain the deprecated symbol and the deprecated package path
44
+ if (!contents.includes(DEPRECATED_SYMBOL) ||
45
+ (!contents.includes(`'${DEPRECATED_PACKAGE}'`) &&
46
+ !contents.includes(`"${DEPRECATED_PACKAGE}"`))) {
47
+ return;
48
+ }
49
+ let changed = false;
50
+ // Re-parse on every iteration so multiple matches in the same file work
51
+ // correctly. The multi-specifier branch prepends a new declaration which
52
+ // shifts every offset; collected AST positions go stale after one rewrite,
53
+ // so process one match at a time.
54
+ let didRewrite = true;
55
+ while (didRewrite) {
56
+ didRewrite = false;
57
+ const sourceFile = (0, tsquery_1.ast)(contents);
58
+ const importNode = (0, tsquery_1.query)(sourceFile, ES_IMPORT_SELECTOR)[0];
59
+ if (importNode) {
60
+ const specifiers = (0, tsquery_1.query)(importNode, IMPORT_SPECIFIERS_SELECTOR);
61
+ const targetIdentifier = (0, tsquery_1.query)(importNode, TARGET_IMPORT_SPECIFIER_SELECTOR)[0];
62
+ if (targetIdentifier) {
63
+ // Walk to the ImportSpecifier to cover `Foo` and `Foo as Bar`.
64
+ const targetSpec = targetIdentifier.parent;
65
+ if (specifiers.length === 1) {
66
+ const modulePathNode = (0, tsquery_1.query)(importNode, ES_MODULE_PATH_SELECTOR)[0];
67
+ if (modulePathNode) {
68
+ contents =
69
+ contents.slice(0, modulePathNode.getStart()) +
70
+ `'${NEW_PACKAGE}'` +
71
+ contents.slice(modulePathNode.getEnd());
72
+ changed = true;
73
+ didRewrite = true;
74
+ continue;
75
+ }
76
+ }
77
+ else {
78
+ // Extract target spec verbatim (preserves alias)
79
+ const end = endAfterTrailingComma(contents, targetSpec.getEnd());
80
+ contents =
81
+ `import { ${targetSpec.getText()} } from '${NEW_PACKAGE}';\n` +
82
+ contents.slice(0, targetSpec.getStart()) +
83
+ contents.slice(end);
84
+ changed = true;
85
+ didRewrite = true;
86
+ continue;
87
+ }
88
+ }
89
+ }
90
+ const stmtNode = (0, tsquery_1.query)(sourceFile, CJS_REQUIRE_STMT_SELECTOR)[0];
91
+ if (stmtNode) {
92
+ const bindingElements = (0, tsquery_1.query)(stmtNode, CJS_BINDING_ELEMENTS_SELECTOR);
93
+ const targetIdentifier = (0, tsquery_1.query)(stmtNode, CJS_TARGET_BINDING_SELECTOR)[0];
94
+ if (targetIdentifier) {
95
+ // Walk to the BindingElement to cover `Foo` and `Foo: Bar`.
96
+ const targetBinding = targetIdentifier.parent;
97
+ if (bindingElements.length === 1) {
98
+ const requirePathNode = (0, tsquery_1.query)(stmtNode, CJS_REQUIRE_PATH_SELECTOR)[0];
99
+ if (requirePathNode) {
100
+ contents =
101
+ contents.slice(0, requirePathNode.getStart()) +
102
+ `'${NEW_PACKAGE}'` +
103
+ contents.slice(requirePathNode.getEnd());
104
+ changed = true;
105
+ didRewrite = true;
106
+ continue;
107
+ }
108
+ }
109
+ else {
110
+ // Extract target binding verbatim (preserves alias)
111
+ const end = endAfterTrailingComma(contents, targetBinding.getEnd());
112
+ contents =
113
+ `const { ${targetBinding.getText()} } = require('${NEW_PACKAGE}');\n` +
114
+ contents.slice(0, targetBinding.getStart()) +
115
+ contents.slice(end);
116
+ changed = true;
117
+ didRewrite = true;
118
+ continue;
119
+ }
120
+ }
121
+ }
122
+ }
123
+ if (changed) {
124
+ tree.write(filePath, contents);
125
+ }
126
+ });
127
+ await (0, devkit_1.formatFiles)(tree);
128
+ }
@@ -0,0 +1,54 @@
1
+ #### Rewrite `NxTsconfigPathsWebpackPlugin` Imports to the `@nx/webpack/tsconfig-paths-plugin` Sub-path
2
+
3
+ The deprecated re-export of `NxTsconfigPathsWebpackPlugin` from `@nx/webpack` is removed in v23. The migration rewrites both ES module imports and CJS `require()` calls to use the `@nx/webpack/tsconfig-paths-plugin` sub-path. Imports that combine the deprecated symbol with other named imports are split into two declarations so the rest of the original import still resolves from `@nx/webpack`. Aliases (`as Plugin`, `: Plugin`) are preserved.
4
+
5
+ #### Sample Code Changes
6
+
7
+ ES module import.
8
+
9
+ ##### Before
10
+
11
+ ```ts title="apps/my-app/webpack.config.ts" {1}
12
+ import { NxTsconfigPathsWebpackPlugin } from '@nx/webpack';
13
+
14
+ export default { plugins: [new NxTsconfigPathsWebpackPlugin()] };
15
+ ```
16
+
17
+ ##### After
18
+
19
+ ```ts title="apps/my-app/webpack.config.ts"
20
+ import { NxTsconfigPathsWebpackPlugin } from '@nx/webpack/tsconfig-paths-plugin';
21
+
22
+ export default { plugins: [new NxTsconfigPathsWebpackPlugin()] };
23
+ ```
24
+
25
+ ES module import combined with other named imports.
26
+
27
+ ##### Before
28
+
29
+ ```ts title="apps/my-app/webpack.config.ts" {1}
30
+ import { NxTsconfigPathsWebpackPlugin, NxAppWebpackPlugin } from '@nx/webpack';
31
+ ```
32
+
33
+ ##### After
34
+
35
+ ```ts title="apps/my-app/webpack.config.ts"
36
+ import { NxTsconfigPathsWebpackPlugin } from '@nx/webpack/tsconfig-paths-plugin';
37
+ import { NxAppWebpackPlugin } from '@nx/webpack';
38
+ ```
39
+
40
+ CJS `require()`.
41
+
42
+ ##### Before
43
+
44
+ ```js title="apps/my-app/webpack.config.js" {1}
45
+ const { NxTsconfigPathsWebpackPlugin } = require('@nx/webpack');
46
+ ```
47
+
48
+ ##### After
49
+
50
+ ```js title="apps/my-app/webpack.config.js"
51
+ const {
52
+ NxTsconfigPathsWebpackPlugin,
53
+ } = require('@nx/webpack/tsconfig-paths-plugin');
54
+ ```
@@ -0,0 +1,3 @@
1
+ import { type Tree } from '@nx/devkit';
2
+ export default function rewriteInternalSubpathImports(tree: Tree): Promise<void>;
3
+ export declare function rewriteSubpathImports(source: string): string;