How the React Compiler is set up in Nyxs and the bugs it causes. Use when changing vite.config.ts's plugins, when a component shows a stale value only in the built app, when reading module-level or global state during render, or when dev builds get slow or time out.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Nyxs React Compiler?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/nyxs-code-nyxs-react-compiler)
---
name: nyxs-react-compiler
description: How the React Compiler is set up in Nyxs and the bugs it causes. Use when changing vite.config.ts's plugins, when a component shows a stale value only in the built app, when reading module-level or global state during render, or when dev builds get slow or time out.
---
# The React Compiler in Nyxs
`vite.config.ts` runs `babel({ presets: [reactCompilerPreset()] })` with **`apply: "build"`**:
it memoizes components in the built app only.
## Why only in the build
In dev, Babel ran on Vite's main thread and took seconds per file (App.tsx about 16 s cold):
the dev server stopped answering, Windows dropped the window's connections
(`ERR_CONNECTION_TIMED_OUT`), Settings showed a red error screen and Plugins took seconds to open.
Don't turn it on for `serve`. `src/App.tsx` is excluded too (`exclude`), and has `"use no memo"`.
## The bug it causes: a value read once
A compiled component that reads a value from outside React during render (a module variable, a
`Map`, `localStorage`, `Date.now()`) keeps the **first** value it read: the compiler memoizes the
render as if that read were pure. It works in dev (not compiled) and breaks only in the release.
Read outside state through a subscription:
```ts
const value = useSyncExternalStore(subscribe, () => store.get(key));
```
- The snapshot function must return the same object while nothing changed (keep a cached
snapshot and replace it on change), or React loops.
- For the time, use `useMinuteClock()` (`src/lib/time.ts`) or a ticker state, not `Date.now()`
in render.
- Examples: `SessionRecap.tsx` (recaps map), `sessionDirectory.ts`, `ultracode.ts`,
`claudeCodeTasks.ts` (`getClaudeCodeTasks` snapshot).
## Opting out
A file that misbehaves under the compiler gets `"use no memo"` at the top, with a comment saying
why. Prefer fixing the read.
## Other build-time pieces
`zodSetup.ts` (imported first in `main.tsx`/`quick.tsx`) sets Zod to `jitless`, so it never
probes `eval` against the CSP. `lazyRetry` (`src/lib/lazyRetry.ts`) wraps lazy views: it retries a
failed chunk and reloads at most once a minute.