Skip to content

Make nx's build runs on next run inside an Nx workspace - #206

Merged
lukekarrys merged 1 commit into
mainfrom
lk/nx-build-workspace
Nov 17, 2026
Merged

lukekarrys merged 1 commit into
mainfrom
lk/nx-build-workspace

Conversation

@lukekarrys

Copy link
Copy Markdown
Member

Closes #205.

nx has failed every build and build-cache run on next since at least 2026-08-02, so it has never had a result there. The cause is that nx needs both of these, and next has neither:

  • an Nx workspace. Without one, nx fails with isn't part of an Nx workspace.
  • a local copy of nx. With only a workspace marker ("nx": {} or nx.json), the global nx fails with Could not find Nx modules.

The run fixture works because it has both (nx devDependency + "nx": {}).

Change

In nx's prepare in build.sh and build-cache.sh only (new BENCH_SETUP_NX in common.sh):

  • install the same nx version as the global one from setup.sh, with npm install --no-save --ignore-scripts;
  • run npm pkg set nx='{}' --json to mark the project as a workspace.

The fixture and lockfile don't change, so no install variation on next is affected. Adding nx as a devDependency would have changed what all of them measure. The cleanup already restores package.json (git checkout) and deletes node_modules.

nx doesn't cache script targets unless configured to, so build-cache stays like-for-like with turbo, which runs with --no-cache. Both measure Next.js's own .next/ cache.

Tested

I ran the real build.sh and build-cache.sh with BENCH_INCLUDE=nx (2 runs each) on this box, in a sandboxed home with global nx 24.0.6:

Variation exit codes times
build 0, 0 33.8 s, 31.4 s
build-cache 0, 0 30.5 s, 23.9 s

After each run, package.json was restored and nothing was left behind. The node tests pass.

🤖 Generated with Claude Code

nx failed every build and build-cache run on next ("isn't part of an Nx
workspace"; with only a workspace marker, "Could not find Nx modules"),
so it has never had a result there. nx's prepare now installs the global
nx version locally with --no-save and sets "nx": {} in package.json.
The fixture and lockfile are unchanged, so no install variation is
affected; cleanup already restores package.json and removes node_modules.

Closes #205

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
benchmarks Ready Ready Preview Nov 17, 2026 7:34pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Nov 17, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 1 minute.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1a22fb58-08c4-4504-9c3f-6d2ba91f5db8
Commits

Reviewing files that changed from the base of the PR and between fb66c63 and 3b121db.

Files selected for processing: 3

  • suite/scripts/variations/build-cache.sh
  • suite/scripts/variations/build.sh
  • suite/scripts/variations/common.sh
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@lukekarrys
lukekarrys merged commit 75199aa into main Nov 17, 2026
78 checks passed
@lukekarrys
lukekarrys deleted the lk/nx-build-workspace branch November 17, 2026 23:43

This branch was previously deployed

1 inactive deployment
Benchmark — 3b121dbf Deployed Nov 17, 2026 by lukekarrys via Run Benchmarks (build-cache, next) #1431
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.

nx fails every build/build-cache run on next: fixture isn't an Nx workspace

1 participant