-
feat(repo): enable the tsgo compiler workspace-wide (#35926)
发布于
2026-06-18 20:34:46 +00:00 Current Behavior
The workspace builds and typechecks every first-party package with
tsc. An earlier attempt to enable the Go-based TypeScript compiler
(tsgo) for justpackages/nx(#35047) was reverted (#35167) because
mixing compilers caused.tsbuildinfoversion-mismatch cascades — a
downstreamtsc --buildwould see a tsgo-stamped build info and
recompile everything.Expected Behavior
The entire
@nx/js/typescriptbuild + typecheck graph — packages,
graph, tools,e2e/**, andnx-dev/ui-fence— compiles withtsgo.
Now that every package is onnodenext(NXC-4538), a single compiler
runs across the whole graph, so there is no cross-compiler
.tsbuildinfocascade.Changes
- Install
@typescript/native-previewand setcompiler: "tsgo"on
both@nx/js/typescriptplugin entries (the package build/typecheck
entry and the e2e/nx-dev typecheck entry — the latter doestsc --build
with references intopackages/*, so it had to move too). tsconfig.base.json: switch tonodenextmodule resolution, remove
baseUrl(tsgo removed it —TS5102), and setstrict: falseto
preserve current tsc behavior (tsgo defaults strict on).- Align spec/e2e tsconfig
moduletonodenext(TS5110) and add
customConditions: ["@nx/nx-source"]to the spec tsconfigs so test
files resolve@nx/*subpaths to workspace source — notably
@nx/devkit/internal-testing-utils, which is excluded from devkit's
build so no declaration is emitted under nodenext. - Source fixes surfaced by tsgo: two accidental workspace-root
(baseUrl-anchored) imports now use package names;@nx/expoaddJest
gets an explicitPromise<GeneratorCallback>return type;@nx/angular
webpack-browser casts past the angular/webpack plugin type difference;
graph/client-e2ecypress global augmentations andAUTWindowcasts;
Taskmocks get the requiredcachefield;
update-repos/create-embeddingsconfig fixes.
Validation
build-base: 42 projects green under tsgo.typecheck: 53 projects, 0 errors under tsgo (entire
@nx/js/typescriptgraph).- lint / test / e2e: pending CI.
Note: tsgo's incremental/cached builds occasionally drop emitted
declarations (observed with devkit'sinternal-testing-utils); a
from-scratch build emits them. Worth watching in CI.The remaining
tscusers —astro-docs(astro check),nx-dev's
Next.js build, and@nx/angular's ng-packagr (ngc) — do nottsc --buildthe packages, so they don't share.tsbuildinfowith the tsgo
graph and coexist safely.Related Issue(s)
Implements Linear NXC-4539 (builds on NXC-4538 — all packages on
nodenext). No GitHub issue to close.
Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
下载附件
- Install