vite: fail fast with a setup hint when the renderer SDK is missing

Today if you clone Nitro-V3 without cloning Nitro_Render_V3 next to it,
yarn start / yarn build fail deep inside Rolldown with:

    Failed to resolve import "@nitrots/nitro-renderer"
    from "/path/to/Nitro-V3/src/App.tsx"

which doesn't tell you what to do. Move the check up to
vite.config.mjs: when neither ../Nitro_Render_V3 nor ../renderer
exists, throw with the explicit clone-and-install steps and a pointer
to CLAUDE.md.

Also update CLAUDE.md "Commands" section:
- Add `yarn preview` (production build server, http://localhost:4173).
- Add a 4-step "Setup walkthrough" covering: clone the renderer
  sibling, yarn install on both, copy public/configuration/*.example
  to *.json, then run.

Net effect: a fresh checkout of this branch shows you exactly which
prerequisite is missing instead of a Rolldown stack trace.
This commit is contained in:
simoleo89
2026-05-12 08:48:11 +00:00
parent 8e0bcce7b9
commit 35b8493696
2 changed files with 48 additions and 0 deletions
+17
View File
@@ -7,6 +7,23 @@ const legacyRendererRoot = resolve(__dirname, '..', 'renderer');
const currentRendererRoot = resolve(__dirname, '..', 'Nitro_Render_V3');
const rendererRoot = existsSync(currentRendererRoot) ? currentRendererRoot : legacyRendererRoot;
if(!existsSync(rendererRoot))
{
// Fail fast with a useful message instead of waiting for Rolldown to
// report "Failed to resolve import @nitrots/nitro-renderer" deep
// inside the bundle pass.
throw new Error(
'\n Nitro renderer SDK not found.\n\n' +
' vite.config.mjs expects one of these directories to exist as a sibling of this repo:\n' +
` - ${ currentRendererRoot } (preferred)\n` +
` - ${ legacyRendererRoot } (legacy)\n\n` +
' Clone the Nitro_Render_V3 repo next to Nitro-V3 and rerun:\n' +
' git clone <renderer-repo> ../Nitro_Render_V3\n' +
' cd ../Nitro_Render_V3 && yarn install\n\n' +
' (See CLAUDE.md "Commands" section for the full setup walkthrough.)\n'
);
}
const ReactCompilerConfig = {
target: '19'
};