-
fix(core): restore nx/src/index entrypoint for Nx Cloud client compatibility (#35712)
发布于
2026-05-16 17:43:00 +00:00 Current Behavior
Under Nx 23.0.0, the Nx Cloud agent client crashes when running tasks:
TypeError: runContinuousTasks is not a function at AgentTaskManager.invokeContinuousTasks at AgentTaskManager.reconcileContinuousTasks at AgentTaskManager.invokeTasks at executeTasksV3The Nx Cloud client probes the nx task APIs by
require-ing
nx/src/index(for the legacyinitTasksRunner) and
nx/src/tasks-runner/init-tasks-runner(for the modern
runDiscreteTasks/runContinuousTasks) inside a single shared
try/catch.PR #35708 removed the deprecated
initTasksRunnerAPI and deleted
packages/nx/src/index.tsentirely — even though that PR's own commit
message stated the file would be kept as an empty module so thenx/src
subpath export mapping stays valid. With the file gone,nx/src/index
no longer resolves (./src/*maps to./dist/src/index.js, which is
never built). Therequire('nx/src/index')throws, the client's shared
catchswallows it, andrunContinuousTasksis never assigned — later
crashing when invoked.runContinuousTasksitself was never removed; it still lives in
packages/nx/src/tasks-runner/init-tasks-runner.tsand is unreachable
here only because the earliernx/src/indexprobe throws.Expected Behavior
packages/nx/src/index.tsis restored as an empty ES module, so the
nx/src/indexentrypoint resolves again via the existing./src/*
mapping inpackage.jsonexports (nopackage.jsonchange needed). The
deprecatedinitTasksRunnerexport stays removed — consumers still get
undefinedfor it — but therequireno longer throws, so the Nx Cloud
client proceeds to loadrunContinuousTasks/runDiscreteTasks
correctly.This restores compatibility for already-published/cached Nx Cloud client
bundles without requiring them to be updated.Related Issue(s)
Internal: NXC-4307 (follow-up to #35708)
Co-authored-by: Jason Jean jasonjean1993@gmail.com
Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>下载附件