chore(bundling): deprecate @nx/webpack, @nx/vite, and @nx/rollup build executors#35576
chore(bundling): deprecate @nx/webpack, @nx/vite, and @nx/rollup build executors#35576FrozenPandaz wants to merge 12 commits intomasterfrom
Conversation
✅ Deploy Preview for nx-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for nx-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
View your CI Pipeline Execution ↗ for commit 1a366cf
☁️ Nx Cloud last updated this comment at |
c789112 to
47ae35d
Compare
563eed1 to
73cc1b8
Compare
73cc1b8 to
8c04e67
Compare
There was a problem hiding this comment.
Important
At least one additional CI pipeline execution has run since the conclusion below was written and it may no longer be applicable.
Nx Cloud is proposing a fix for your failed CI:
We removed the cross-package import of warnWebpackExecutorScaffolding from @nx/webpack/src/utils/deprecation and inlined the equivalent logger.warn(...) call directly in packages/react/src/generators/application/lib/add-project.ts. This mirrors the existing pattern already used for the rspack warning in the same file and eliminates the runtime require that failed when @nx/webpack was resolved from the npm registry rather than a local build, fixing all 42 failing e2e tasks.
Warning
❌ We could not verify this fix.
diff --git a/packages/react/src/generators/application/lib/add-project.ts b/packages/react/src/generators/application/lib/add-project.ts
index fd2f6c9f..0c9f6f70 100644
--- a/packages/react/src/generators/application/lib/add-project.ts
+++ b/packages/react/src/generators/application/lib/add-project.ts
@@ -12,7 +12,6 @@ import {
import { hasWebpackPlugin } from '../../../utils/has-webpack-plugin';
import { maybeJs } from '../../../utils/maybe-js';
import { hasRspackPlugin } from '../../../utils/has-rspack-plugin';
-import { warnWebpackExecutorScaffolding } from '@nx/webpack/src/utils/deprecation';
import type { PackageJson } from 'nx/src/utils/package-json';
export function addProject(host: Tree, options: NormalizedSchema) {
@@ -26,7 +25,12 @@ export function addProject(host: Tree, options: NormalizedSchema) {
if (options.bundler === 'webpack') {
if (!hasWebpackPlugin(host) || !options.addPlugin) {
- warnWebpackExecutorScaffolding();
+ // Mirrors warnWebpackExecutorScaffolding from @nx/webpack/src/utils/deprecation.
+ // Inlined to avoid a cross-package runtime require that breaks when @nx/webpack
+ // is resolved from the npm registry rather than a local build.
+ 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.'
+ );
project.targets = {
build: createBuildTarget(options),
serve: createServeTarget(options),
🔔 Heads up, your workspace has pending recommendations ↗ to auto-apply fixes for similar failures.
Or Apply changes locally with:
npx nx-cloud apply-locally MoOI-sf4K
Apply fix locally with your editor ↗ View interactive diff ↗
🎓 Learn more about Self-Healing CI on nx.dev
…v-server executors Add runtime + scaffold-time deprecation warnings and a schema-root x-deprecated for @nx/webpack:webpack and @nx/webpack:dev-server. All messages link to the general convert-to-inferred guide and point users at `nx g @nx/webpack:convert-to-inferred` and the `@nx/webpack/plugin` inferred plugin. Scaffold-time warnings fire from the @nx/webpack:configuration generator and from the @nx/react / @nx/react-native scaffold paths that bake the executor targets in directly.
…iew-server executors Add runtime + scaffold-time deprecation warnings and a schema-root x-deprecated for @nx/vite:build, @nx/vite:dev-server, and @nx/vite:preview-server. All messages link to the general convert-to-inferred guide and point users at `nx g @nx/vite:convert-to-inferred` and the `@nx/vite/plugin` inferred plugin. The @nx/vite:test executor is covered by the test-runner deprecation batch and is intentionally left out.
Add runtime + scaffold-time deprecation warnings and a schema-root x-deprecated for @nx/rollup:rollup. The warnings link to the general convert-to-inferred guide and point users at `nx g @nx/rollup:convert-to-inferred` and the `@nx/rollup/plugin` inferred plugin. Scaffold-time warning fires from @nx/rollup:configuration and from the @nx/react library generator's legacy executor-target fallback when @nx/rollup/plugin is not registered.
…tors Add runtime + scaffold-time deprecation warnings and a schema-root x-deprecated for @nx/next:build and @nx/next:server. Warnings link to the general convert-to-inferred guide and point users at `nx g @nx/next:convert-to-inferred` and the `@nx/next/plugin` inferred plugin. Scaffold-time warning fires from @nx/next:application when @nx/next/plugin is not registered.
…tors Add runtime deprecation warnings and a schema-root x-deprecated for @nx/remix:build and @nx/remix:serve. Warnings link to the general convert-to-inferred guide and point users at `nx g @nx/remix:convert-to-inferred` and the `@nx/remix/plugin` inferred plugin. No scaffold-time warning is needed because @nx/remix:application already only registers the inferred plugin and never emits executor targets directly.
…ion time The previous wording started with "Scaffolding ..." and asked the user to register `@nx/<pkg>/plugin` in `nx.json` first as a separate step. Both points were noisy: "scaffolding" reads strangely in user-facing output, and `convert-to-inferred` already registers the plugin in nx.json, so directing users at the generator is enough. Each generation-time warning now starts with "Generating ..." and reads as a single ask: run `nx g @nx/<pkg>:convert-to-inferred` next, which both migrates the just-generated targets to the inferred plugin and prevents future generators from emitting executor targets. Also retargets the detox warning's URL at the general convert-to-inferred guide for consistency with the rest of the family.
Add runtime + scaffold-time deprecation warnings and a schema-root x-deprecated for @nx/jest:jest. Warnings link to the general convert-to-inferred guide and point users at `nx g @nx/jest:convert-to-inferred` and the `@nx/jest/plugin` inferred plugin. Scaffold-time warning fires from @nx/jest:configuration when the inferred plugin is not registered or `addExplicitTargets` is set.
Add runtime + scaffold-time deprecation warnings and a schema-root x-deprecated for @nx/playwright:playwright. Warnings link to the general convert-to-inferred guide and point users at `nx g @nx/playwright:convert-to-inferred` and the `@nx/playwright/plugin` inferred plugin. Scaffold-time warning fires from @nx/playwright:configuration when the inferred plugin is not registered.
Add runtime + scaffold-time deprecation warnings and a schema-root x-deprecated for @nx/eslint:lint. Warnings link to the general convert-to-inferred guide and point users at `nx g @nx/eslint:convert-to-inferred` and the `@nx/eslint/plugin` inferred plugin. Scaffold-time warning fires from @nx/eslint:lint-project when it falls back to the executor target because the inferred plugin is not registered.
…book:build executors Add runtime + scaffold-time deprecation warnings and a schema-root x-deprecated for both executors. Warnings link to the general convert-to-inferred guide and point users at `nx g @nx/storybook:convert-to-inferred` and the `@nx/storybook/plugin` inferred plugin. Scaffold-time warning fires from @nx/storybook:configuration when the inferred plugin is not registered or `addExplicitTargets` is set.
…ver executors Add runtime + scaffold-time deprecation warnings and a schema-root x-deprecated for both executors. Warnings link to the general convert-to-inferred guide and point users at `nx g @nx/rspack:convert-to-inferred` and the `@nx/rspack/plugin` inferred plugin. Scaffold-time warning fires from @nx/rspack:configuration and from the @nx/react:application generator's rspack branch when @nx/rspack/plugin is not registered. Inlined the warning in the @nx/react caller because react does not declare a TypeScript project reference to rspack.
…nferred Add runtime + scaffold-time deprecation warnings and a schema-root x-deprecated for the eight @nx/expo executors that have a migration path through `@nx/expo:convert-to-inferred`: build, export, install, prebuild, run, serve, start, and submit. Warnings link to the general convert-to-inferred guide and point users at the `@nx/expo/plugin` inferred plugin. Scaffold-time warning fires from @nx/expo:application when the inferred plugin is not registered. `@nx/expo:build-list`, `:sync-deps`, `:update`, and `:ensure-symlink` are not covered by `convert-to-inferred`, so they stay as-is.
8c04e67 to
1a366cf
Compare
Current Behavior
Most Nx executors that have an inferred-plugin alternative (
@nx/<pkg>/plugin) and aconvert-to-inferredgenerator are still wired up like first-class citizens. There is no signal — at scaffold time, schema browsing, or task execution — that they are on a path to removal, and the existingcypress/detoxdeprecation messages are inconsistent with the canonical pattern shipped most recently.Expected Behavior
Every executor that has an inferred-plugin migration target is now deprecated through three surfaces, matching the canonical pattern:
nx g @nx/<pkg>:convert-to-inferred.x-deprecated. Surfaces in editor / Nx Console /nx show projectviews.All warnings link to https://nx.dev/docs/guides/tasks--caching/convert-to-inferred.
Executors deprecated in this PR
@nx/webpackwebpack,dev-server@nx/vitebuild,dev-server,preview-server@nx/rolluprollup@nx/nextbuild,server@nx/remixbuild,serve@nx/jestjest@nx/playwrightplaywright@nx/eslintlint@nx/storybookstorybook,build@nx/rspackrspack,dev-server@nx/expobuild,export,install,prebuild,run,serve,start,submitGeneration-time warnings wired in
@nx/<pkg>:configurationfor webpack, vite, rollup, jest, playwright, storybook, rspack@nx/<pkg>:applicationfor next, expo@nx/eslint:lint-projectlegacy fallback path@nx/react:application(webpack, rspack branches) — inline because react does not have a tsconfig project reference to rspack@nx/react:library(rollup legacy fallback)@nx/react-native:web-configuration(webpack) — inline for the same reasonScope notes
@nx/vite:testand@nx/vitest:testare intentionally not included —@nx/vite:testis being removed entirely by PR feat(vite)!: remove vitest support in favor of @nx/vitest #35517 (deprecation messaging would ship as dead code), and@nx/vitest:testis the destination of feat(vite)!: remove vitest support in favor of @nx/vitest #35517's migration, so deprecating it in the same release would be confusing user-facing messaging. Both are tracked as follow-ups once feat(vite)!: remove vitest support in favor of @nx/vitest #35517 settles.@nx/cypress/@nx/detoxalready shipped earlier; this PR retitles their generation-time messages to the new wording (drop the redundant "register the plugin first" guidance, swap "Scaffolding" for "Generating") and points the detox URL at the general convert-to-inferred guide.@nx/webpack:ssr-dev-server,@nx/expo:build-list,@nx/expo:sync-deps,@nx/expo:update, and@nx/expo:ensure-symlinkare intentionally left as-is — none are covered byconvert-to-inferred.@nx/esbuild:esbuildand@nx/nuxt:*ship neither an inferred plugin nor aconvert-to-inferredgenerator yet, so they're out of scope.migrations.jsonentries are intentionally skipped per the canonical pattern (NXC-4422). The runtime warning carries the migration story.Related Issue(s)
Fixes NXC-4423.