-
fix(js): build to local dist and use nodenext (#35538)
发布于
2026-05-15 22:41:15 +00:00 Current Behavior
@nx/jsbuilds to the shared workspace-rootdist/packages/js/
directory, uses CommonJSmodule/moduleResolution, has noexports
map, and relies on.npmignore-style filtering through assets.json
copies. This makes the package layout diverge from the new pattern
already adopted bynxand@nx/devkit.Expected Behavior
@nx/jsfollows the same local-dist build pattern asnxand
@nx/devkit:- Builds to
packages/js/dist/instead ofdist/packages/js/. tsconfig.lib.jsonusesmodule/moduleResolution: "nodenext"with
composite,rootDir: ".", anddeclarationDir: "dist".package.jsondeclares anexportsmap with the@nx/nx-source
condition (workspace consumers resolve to.tssource, published
consumers get built.js), plus a./src/*wildcard so the ~296
existing internal imports of@nx/js/src/...keep working.typesVersionsadded for legacymoduleResolution: "node"consumers.- Adopts an explicit
filesfield onpackage.jsoninstead of
asset-copying the root JSONs. generators.json,executors.json,migrations.jsonfactory/schema
paths rewritten./src/...→./dist/src/...(matchesnx). Workspace
dev still works via thetryResolveFromSourcefallback in
packages/nx/src/config/schema-utils.ts.README.md→readme-template.md; build command writes the rendered
README topackages/js/README.md. Root.gitignorenow ignores
packages/js/README.mdandpackages/js/**/*.d.ts(with
!packages/js/src/**/schema.d.tsexception for committed schema
declarations).- ESLint flat config ignores
distand**/*.d.ts. project.jsonaddsrelease.versionconfig (with
preserveLocalDependencyProtocols: falseso the not-yet-migrated
@nx/workspacedep is substituted to a concrete version at version-time
rather than left asworkspace:*for pnpm publish to resolve from the
un-bumped sourcepackages/workspace/package.json) and
nx-release-publish.packageRoot. Thebuildtarget keeps its existing
dependsOn: ["build-base"](cannot use^buildbecause js's
implicitDependenciescreate a cycle througheslint/
eslint-plugin).scripts/nx-release.ts: addspackages/jstopackagesToResetso
the sourcepackages/js/package.jsonis restored after release.
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