Skip to content

fix(config): drop three dead next.config entries and correct two stale comments - #6076

Merged
waleedlatif1 merged 1 commit into
stagingfrom
fix/next-config-dead-entries
Jul 30, 2026
Merged

fix(config): drop three dead next.config entries and correct two stale comments#6076
waleedlatif1 merged 1 commit into
stagingfrom
fix/next-config-dead-entries

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

Three entries in apps/sim/next.config.ts were inert. Removing them is behavior-neutral. Also corrects two comments that claimed more than the code does.

This came out of an audit of build-speed levers. None of these is a performance fix — they are hygiene, and I'd rather say so than imply a win that isn't there.

The optimizePackageImports finding

The Next 16.2.11 docs state, verbatim: "Turbopack automatically analyzes imports and optimizes them. It does not require this configuration." That sentence is not backed by the code. At tag v16.2.11:

  • crates/next-core/src/next_client/context.rs:362 and next_server/context.rs:586 — the list feeds side_effect_free_packages
  • next_server/context.rs:167 — the list is force-appended to transpiled_packages, and :191 then removes those entries from the server externals set
  • turbopack-ecmascript/src/chunk/placeable.rs:235 — the glob short-circuits ahead of each package's own package.json sideEffects field. It is an override, not a hint.

Next's own turbopack-warning.js also does not list the option as Turbopack-unsupported. So a stale entry is not free: it costs transform work and silently overrides a package's sideEffects declaration.

What was removed

Entry Why it's dead
lodash (optimizePackageImports) Zero import sites repo-wide, and not a dependency of any package here. Next already applies a lodash → lodash/{{member}} modularizeImports rule unconditionally.
@radix-ui/react-accordion (same) Zero import sites — its only occurrence in the repo was this config line. Present in node_modules only via transitive hoisting.
prettier (transpilePackages) Nothing imports it, it's in no package.json, and the repo formats with Biome. transpilePackages matches modules already in the graph, so this transpiled nothing.

What was deliberately left alone

  • zod, reactflow, framer-motion, streamdown — real barrels with real import sites (zod has 389). Removing them removes genuine side_effect_free_packages tree-shaking hints and could grow the client bundle. That's a measurable tradeoff, not a cleanup.
  • The 8 remaining @radix-ui/react-* entries — each is a 2-file pre-bundled package, outside the option's documented purpose ("hundreds or thousands of modules"), so they're likely noise plus sideEffects-override risk. But they are imported, so removal is a bundle-size question. Deferred on purpose.
  • @react-email/* and @t3-oss/* in transpilePackages — these are where real transform work happens, and all four ship prebuilt JS meeting no documented criterion. Not touched: they were added empirically to fix real bugs, and the @t3-oss failure mode is silently-undefined client env, which ships unnoticed.
  • The whole transpilePackages array must stay non-empty. webpack-config.js gates shouldIncludeExternalDirs on !!config.transpilePackages, so emptying it would break dev:webpack compiling packages/*/src. Individual removals are fine.

Comment corrections

  • The .map header rule was labelled "Block access to sourcemap files (defense in depth)". It sets x-robots-tag: noindex and a TTL — it blocks nothing, and the maps ship publicly in the production image (docker/app.Dockerfile:107).
  • The minimal-registry comment was stale and causally wrong. Measured today: 4,351 tool entries (not ~247) pulling ~5,907 modules (not ~2,074); BLOCK_REGISTRY is 313. Blocks are not a co-equal cost — blocks/registry-maps alone is ~349 modules and mostly rides in behind the tool registry. And the registry is reached via four redundant client-reachable edges, not just providers/utils → tools/params, which is why cutting that one edge buys a single module.

Type of Change

  • Improvement (hygiene / comment accuracy)

Testing

tsc --noEmit clean (exit 0), biome check clean. Config-only change with no runtime code touched; the removed entries were inert by the mechanisms cited above. The CI Build App check exercises the real build.

…e comments

`optimizePackageImports` is not a no-op under Turbopack, despite what the
Next docs say. In 16.2.11 the list feeds `side_effect_free_packages` and is
force-appended to `transpiledPackages`, which also removes each entry from
the server externals set — and it overrides each listed package's own
`sideEffects` declaration rather than hinting. So a stale entry is not free.

Two entries are provably dead: `lodash` has zero import sites repo-wide and
is not a dependency of any package here (Next also already applies a
`lodash -> lodash/{{member}}` modularizeImports rule unconditionally), and
`@radix-ui/react-accordion`'s only occurrence in the repo was this line.

`prettier` in `transpilePackages` is dead for a different reason: nothing
imports it, it is in no package.json, and the repo formats with Biome. It
sits in node_modules only as a transitive dep. `transpilePackages` matches
on modules already in the graph, so this entry was transpiling nothing.

Also corrects two comments that claimed more than the code does:
- the `.map` header rule said it blocks access to sourcemaps; it only sets
  `noindex` and a TTL. The maps ship publicly in the production image.
- the minimal-registry comment's numbers were badly stale (~247 tools ->
  4,351; ~2,074 modules -> ~5,907) and its framing wrong: blocks are not a
  co-equal cost, and the tool registry is reached through four redundant
  client edges, not just providers/utils — which is why cutting only that
  one edge buys a single module.

No behavior change intended: the removed entries were inert. Kept `zod`,
`reactflow`, `framer-motion`, and `streamdown`, which are real barrels with
real import sites — removing those changes tree-shaking hints and needs a
bundle-size measurement, not a guess.
@vercel

vercel Bot commented Jul 30, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Jul 30, 2026 12:52am

Request Review

@cursor

cursor Bot commented Jul 30, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Config-only removal of inert entries and comment updates; no application code paths changed.

Overview
Config hygiene only — no intended runtime or bundle behavior change from dropping entries that were never wired into the app graph.

Removes lodash and @radix-ui/react-accordion from optimizePackageImports and prettier from transpilePackages because nothing in the repo imports them (lodash is also covered by Next’s built-in modularize rule).

Adds a comment that optimizePackageImports still matters under Turbopack (feeds side_effect_free_packages / transpile overrides), so the remaining list should only name packages that are actually imported.

Comment fixes: the dev minimal-registry blurb is updated with current module-count measurements and the four client edges into @/tools/registry; the .map header rule is described as search-index / cache TTL, not blocking access to publicly shipped sourcemaps.

Reviewed by Cursor Bugbot for commit 9e7c380. Configure here.

@greptile-apps

greptile-apps Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Hygiene-only cleanup in apps/sim/next.config.ts: drops three inert package entries and corrects two stale comments.

  • Removes unused lodash and @radix-ui/react-accordion from optimizePackageImports
  • Removes unused prettier from transpilePackages (array stays non-empty)
  • Updates the minimal-registry and sourcemap header comments to match actual behavior

Confidence Score: 5/5

Safe to merge; config hygiene with no remaining behavioral risk from the removed entries.

Removed packages have no import sites or direct dependencies in apps/sim; transpilePackages remains populated; remaining edits are comment accuracy only.

Important Files Changed

Filename Overview
apps/sim/next.config.ts Dead optimizePackageImports/transpilePackages entries removed; comments corrected; no runtime code paths changed.

Reviews (1): Last reviewed commit: "fix(config): drop three dead next.config..." | Re-trigger Greptile

@waleedlatif1
waleedlatif1 merged commit 0a0acc2 into staging Jul 30, 2026
27 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/next-config-dead-entries branch July 30, 2026 01:04
waleedlatif1 added a commit that referenced this pull request Jul 30, 2026
`vitest.setup.ts` loaded `@testing-library/jest-dom/vitest` unconditionally,
so all 1,219 test files paid for it. jest-dom only registers DOM matchers
(`toBeInTheDocument`, `toBeVisible`, ...), which are useless without a
document — and 985 of those files declare `@vitest-environment node`.

Guarding the import on `typeof document !== 'undefined'` loads it for exactly
the files that can use it. All 7 files that actually call a jest-dom matcher
are explicitly `@vitest-environment jsdom`, so none loses anything; verified
by running them.

Measured locally, same machine, full suite:

  baseline   Duration 179.47s  (setup 367.13s aggregate)
  guarded    Duration 165.78s  (setup 252.72s aggregate)

7.6% off the suite, 31% off aggregate setup time. On a node-only subset
(50 files, n=3 each) it is 21%: 2.75s -> 2.16s median. Identical results
either way: 1225 files / 16184 tests pass, plus one failure that reproduces
on unmodified staging (cloud-review-tools.test.ts cannot find `rg` from its
spawned python3 locally; CI installs ripgrep explicitly and it passes there).

Also fixes two pieces of CI documentation that claimed more than the code
does — the same class of thing #6076 cleaned up:

- The step was named "Run tests with coverage" but runs `bun run test` =
  `vitest run`, with no `--coverage` anywhere.
- The Codecov upload reads `apps/sim/coverage`, which nothing generates
  (vitest.config.ts declares no coverage provider). It uploads nothing and
  still reports success in ~1s because `fail_ci_if_error: false`. Annotated
  rather than deleted, since whether to enable coverage or drop the step is
  a call for the team, not a side effect of a perf change.
waleedlatif1 added a commit that referenced this pull request Jul 30, 2026
`vitest.setup.ts` loaded `@testing-library/jest-dom/vitest` unconditionally,
so all 1,219 test files paid for it. jest-dom only registers DOM matchers
(`toBeInTheDocument`, `toBeVisible`, ...), which are useless without a
document — and 985 of those files declare `@vitest-environment node`.

Guarding the import on `typeof document !== 'undefined'` loads it for exactly
the files that can use it. All 7 files that actually call a jest-dom matcher
are explicitly `@vitest-environment jsdom`, so none loses anything; verified
by running them.

Measured locally, same machine, full suite:

  baseline   Duration 179.47s  (setup 367.13s aggregate)
  guarded    Duration 165.78s  (setup 252.72s aggregate)

7.6% off the suite, 31% off aggregate setup time. On a node-only subset
(50 files, n=3 each) it is 21%: 2.75s -> 2.16s median. Identical results
either way: 1225 files / 16184 tests pass, plus one failure that reproduces
on unmodified staging (cloud-review-tools.test.ts cannot find `rg` from its
spawned python3 locally; CI installs ripgrep explicitly and it passes there).

Also fixes two pieces of CI documentation that claimed more than the code
does — the same class of thing #6076 cleaned up:

- The step was named "Run tests with coverage" but runs `bun run test` =
  `vitest run`, with no `--coverage` anywhere.
- The Codecov upload reads `apps/sim/coverage`, which nothing generates
  (vitest.config.ts declares no coverage provider). It uploads nothing and
  still reports success in ~1s because `fail_ci_if_error: false`. Annotated
  rather than deleted, since whether to enable coverage or drop the step is
  a call for the team, not a side effect of a perf change.
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.

1 participant