Skip to content

fix(repo): Align nx cache outputs with actual build outputs - #23929

Merged
mydea merged 3 commits into
developfrom
feat/nx-build-cache-outputs
Sep 2, 2026
Merged

fix(repo): Align nx cache outputs with actual build outputs#23929
mydea merged 3 commits into
developfrom
feat/nx-build-cache-outputs

Conversation

@mydea

@mydea mydea commented Sep 2, 2026

Copy link
Copy Markdown
Member

Audits every cached nx target's outputs against what each package's build command actually emits, and fixes the mismatches. When a target produces a file that isn't listed in its outputs, nx never stores it in the cache — so a later cache hit restores an incomplete build/, silently missing files until a full rebuild.

build:transpile — the makeOrchestrionLoader('./build') helper emits build/import-hook.mjs, but only some of its callers declared it. Added it for the remaining server SDKs: astro, aws-serverless, google-cloud-serverless, remix, tanstackstart-react. (node and nextjs already declared it.)

build:types — several packages run a second tsc for subpath exports that writes declarations outside build/types, uncaptured by any cached target:

  • vue — had no override at all; its tsconfig.router-types.json emits tanstackrouter.d.ts + .d.ts.map at the package root. Added an override mirroring solid (build/types, *.d.ts, *.d.ts.map).
  • nestjs — its setup-types config has declarationMap: true, so it also emits *.d.ts.map at root, which the override was missing.
  • deno — declared build-types, a directory that is never produced; its tsc actually writes declarations into build/esm. Repointed to build/esm/**/*.d.ts (recursive, since deno's src is nested).

Root cause: these outputs lists were maintained by hand as build steps were added (extra tsc passes, the orchestrion import-hook), so per-package emitters drifted out of sync with the declarations.

Verified against the rollup/tsconfig configs rather than on-disk build/ dirs, since some of those are stale (e.g. leftover packages/node-core/, packages/tanstackstart/ with no package.json). The other cached targets — build:bundle (build/bundles), build:tarball (*.tgz), build:layer (build/aws), lint (no outputs), test:unit (coverage) — were checked and already correct.

🤖 Generated with Claude Code

https://claude.ai/code/session_01SFugqE3KWYfwqEfqEbjLsB

Audit of every cached nx target's `outputs` against what each build
command actually emits, fixing mismatches that would drop files on a
cache restore.

build:transpile — declare the `build/import-hook.mjs` emitted by
`makeOrchestrionLoader` for the remaining server SDKs (astro,
aws-serverless, google-cloud-serverless, remix, tanstackstart-react).

build:types — capture root subpath-export declarations that no cached
target was covering:
- vue: add override for root `*.d.ts`/`*.d.ts.map` (tanstackrouter)
- nestjs: add missing `*.d.ts.map`
- deno: point at `build/esm/**/*.d.ts` (real location) instead of the
  never-produced `build-types`

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SFugqE3KWYfwqEfqEbjLsB

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 00afc28. Configure here.

Comment thread packages/deno/package.json
"{projectRoot}/build/import-hook.mjs"
]
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix PR missing regression test

Low Severity

This fix PR has no test that would fail if an nx outputs list again missed a file the build emits. The review guidelines for fix PRs require a regression test, which is what let these cache lists drift in the first place.

Additional Locations (2)
Fix in Cursor Fix in Web

Triggered by project rule: PR Review Guidelines for Cursor Bot

Reviewed by Cursor Bugbot for commit 00afc28. Configure here.

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 28.57 kB - -
@sentry/browser - with treeshaking flags 26.94 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 26.83 kB - -
@sentry/browser (incl. Tracing) 48.87 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 48.88 kB - -
@sentry/browser (incl. Tracing, Profiling) 51.8 kB - -
@sentry/browser (incl. Tracing, Replay) 88.36 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 77.76 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 93.05 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 106.02 kB - -
@sentry/browser (incl. Feedback) 46.06 kB - -
@sentry/browser (incl. sendFeedback) 33.64 kB - -
@sentry/browser (incl. FeedbackAsync) 38.74 kB - -
@sentry/browser (incl. Metrics) 29.52 kB - -
@sentry/browser (incl. Logs) 29.81 kB - -
@sentry/browser (incl. Metrics & Logs) 30.45 kB - -
@sentry/react 30.32 kB - -
@sentry/react (incl. Tracing) 51.08 kB - -
@sentry/vue 35.74 kB - -
@sentry/vue (incl. Tracing) 51.14 kB - -
@sentry/svelte 28.6 kB - -
CDN Bundle 30.36 kB - -
CDN Bundle (incl. Tracing) 49.52 kB - -
CDN Bundle (incl. Logs, Metrics) 32.59 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 51.43 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 73.19 kB - -
CDN Bundle (incl. Tracing, Replay) 87 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 88.88 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 92.93 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 94.83 kB - -
CDN Bundle - uncompressed 89.97 kB - -
CDN Bundle (incl. Tracing) - uncompressed 147.57 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 96.27 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 153.26 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 225.43 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 267.07 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 272.74 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 280.77 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 286.43 kB - -
@sentry/nextjs (client) 53.7 kB - -
@sentry/sveltekit (client) 49.3 kB - -
@sentry/core/server 40.74 kB - -
@sentry/core/browser 13.42 kB - -
@sentry/node 124.12 kB +0.02% +21 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 81.51 kB - -
@sentry/node - without tracing 88.3 kB +0.03% +21 B 🔺
@sentry/node - without channel injection 103.42 kB +0.02% +19 B 🔺
@sentry/aws-serverless 96.66 kB +0.03% +23 B 🔺
@sentry/cloudflare (withSentry) - minified 200.81 kB - -
@sentry/cloudflare (withSentry) 499.76 kB - -

View base workflow run

mydea and others added 2 commits September 2, 2026 13:52
…sjoint

deno's build:transpile cached the whole build/ tree, which contains the
.d.ts files build:types emits into build/esm (tsc emitDeclarationOnly +
outDir build/esm). With both targets claiming those declarations and no
dependsOn edge between them, they run in parallel and a build:transpile
cache restore can overwrite or drop the declarations build:types just
produced or restored.

Exclude the declaration files from build:transpile's outputs so the two
targets' claims are disjoint; build:types remains their sole owner.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SFugqE3KWYfwqEfqEbjLsB
A negated Nx output (e.g. "!{projectRoot}/build/esm/**/*.d.ts") only
narrows a target's cache ownership to keep parallel targets' outputs
disjoint; it is not a file to exclude from the uploaded artifact. The
script mapped every output to an upload path and threw on the leading
"!" because it fails the project-prefix check. Skip negated outputs so
those files are still uploaded via the target that owns them.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SFugqE3KWYfwqEfqEbjLsB
@mydea
mydea marked this pull request as ready for review September 2, 2026 12:16
@mydea
mydea requested review from a team as code owners September 2, 2026 12:16
@mydea
mydea requested review from JPeer264, isaacs, nicohrubec and s1gr1d and removed request for a team September 2, 2026 12:16

@JPeer264 JPeer264 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

@mydea
mydea merged commit a953054 into develop Sep 2, 2026
124 checks passed
@mydea
mydea deleted the feat/nx-build-cache-outputs branch September 2, 2026 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants