-
chore(core)!: build @nx/workspace to local dist and use nodenext (#35643)
发布于
2026-05-13 02:27:49 +00:00 Current Behavior
@nx/workspacebuilds to the shared workspace-root
dist/packages/workspace/directory, uses CommonJS
module/moduleResolution, and has noexportsmap. Other Nx packages
and external plugins reach into@nx/workspace/src/*subpaths for
internal utilities.Expected Behavior
@nx/workspacefollows the same local-dist build pattern asnxand
@nx/devkit:- Builds to
packages/workspace/dist/instead of
dist/packages/workspace/. tsconfig.lib.jsonusesmodule/moduleResolution: "nodenext"with
composite,rootDir: ".",declarationDir: "dist".package.jsondeclares anexportsmap matching@nx/devkit's
locked-down surface — only named entry points, no./src/*wildcard.generators.json/executors.jsonfactory/schema paths rewritten
./src/...→./dist/src/.... Workspace dev still works via the
tryResolveFromSourcefallback in
packages/nx/src/config/schema-utils.ts.README.md→readme-template.md; build command writes the rendered
README topackages/workspace/README.md.project.jsonaddsrelease.versionconfig
(preserveLocalDependencyProtocols: true, matching nx/devkit).scripts/nx-release.ts: addspackages/workspaceto
packagesToReset.
Internal-leak cleanup so the locked-down exports map doesn't break
first-party callers:TypeScriptCompilationOptions+compileTypeScriptmoved from
@nx/workspaceto@nx/js(the package that owns TypeScript
compilation).@nx/remixinlinesdirectoryExists(was a one-line re-export
wrapper).@nx/rspackdrops the Nx 15.7-era
@nx/workspace/src/utils/create-ts-configfallback.- e2e helpers source
angularDevkitVersionfrom@nx/angular/src/utils
instead. @nx/workspaceand@nx/remixno longer declare@nx/workspacedeps
they don't use.- Adds a preflight step to the
dist-build-migrationskill that warns
aboutworkspace:*deps on not-yet-migrated packages.
Breaking Changes
@nx/workspace/src/*subpath imports are no longer supported. The
exportsmap no longer declares a./src/*wildcard. ~150 public
consumers across GitHub use these subpaths today (the largest cluster is
src/utilities/fileutilswith ~60 hits). Migration:@nx/workspace/src/utilities/fileutils(directoryExists,
fileExists,isRelativePath,createDirectory) — these are thin
re-exports fromnx/src/utils/fileutils. Inline withnode:fs
(statSync(p).isDirectory()fordirectoryExists) or import from
@nx/devkitwhere equivalent.@nx/workspace/src/utilities/typescript/compilation— moved to
@nx/js. Internal callers should import from there; if you were
depending on the type externally, copy it or use the equivalent from
@nx/js.@nx/workspace/src/utils/versions— values are duplicated across
packages; reimplement against the version of Nx you're targeting.- Other subpaths — check the
@nx/workspace's publicindex.ts
re-exports first; otherwise reimplement.
@nx/workspace/tasks-runners/defaultnow throws when invoked. This
module was an alias fornx/src/tasks-runner/default-tasks-runner. The
Nx 17 (use-minimal-config-for-tasks-runner-options) and Nx 21
(remove-custom-tasks-runner) migrations rewrite/remove legacy
tasksRunnerOptionsentries. If yournx.jsonstill references
@nx/workspace/tasks-runners/default, replace it with
nx/tasks-runners/default.Related Issue(s)
Part of the ongoing migration of Nx packages to the local-dist build
layout (followingnxand@nx/devkit).
Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: FrozenPandaz FrozenPandaz@users.noreply.github.com下载附件
- Builds to