Skip to content

feat(vite-plugin-ngp): link each error and warning to its troubleshooting entry - #172

Merged
ChristopherPHolder merged 4 commits into
mainfrom
docs/troubleshooting
Dec 4, 2026
Merged

ChristopherPHolder merged 4 commits into
mainfrom
docs/troubleshooting

Conversation

@ChristopherPHolder

Copy link
Copy Markdown
Collaborator

Closes #152

What changed

A Troubleshooting page (site/content/troubleshooting.md). It's grouped the way Vite's troubleshooting page is: installing, when Vite starts, dev server, HMR, builds, type-checking, server rendering, i18n, Vitest and ngp-generate. Each entry's heading is the exact message, or its stable prefix, or a symptom when there's no message. Under it: what the message means, why it happens, what to do, and a link to the page with the detail. The page ends with how to make a minimal reproduction (an app from npm create @push-based/ngp@latest) and how to file a bug.

  • Configuration's "When the plugin stops" table moved here. One line is left pointing at the page.
  • The known failure modes in status.md, nx.md, creating-an-app.md, compatibility.md, configuration.md and testing.md each have an entry that links back to where they're described.
  • Sidebar placement: last in the Guide section, after Server rendering. Vite puts it in the same place, and it's where someone stuck with an error scans the list of task pages. It isn't buried among the feature pages.

Messages link to their entry. src/troubleshooting.ts adds seeTroubleshooting(anchor). 30 call sites now end with \nSee https://push-based.github.io/vite-plugin-ngp/troubleshooting/#<anchor>. Each source edit stays on the lines it changes, plus one import line per file.

Named anchors. Each heading is written ### Message {#anchor}, and site/scripts/markdown.ts uses the {#anchor} part as the heading's id. An installed version of the plugin keeps linking the same id after the heading is reworded; an id made from the heading text wouldn't survive that.

Check. pnpm docs:check (run in CI) finds every seeTroubleshooting('...') call in the plugin's source. It fails when the page has no heading with that id, when the argument isn't a string literal, or when a page uses the same {#id} twice. Decision 88 and a row in design.md record the approach. There's a changelog line under 4 December → Docs.

Inventory of messages

Message (source) Entry
engine / typeChecker / test.extendedDiagnostics / cache.dir / workspaceRoot must be … (index.ts) #invalid-option
cache.dir is …, which holds Vite's root (index.ts) #cache-dir-holds-root
no tsconfig found in … (index.ts) #no-tsconfig
ssr.server is …, and … does not exist (index.ts) #ssr-server-missing
i18n with @angular/ssr is not supported yet (index.ts) #i18n-with-angular-ssr
test.externalLibraries needs pool … (index.ts) #external-libraries-pool
HMR update for … failed, reloading ×2, incl. changed on disk, and the watcher never reported it (index.ts) #hmr-update-failed (was undocumented)
HMR failed for …. Reloading. (index.ts) #hmr-failed (was undocumented)
NG4003–NG4005 option diagnostics (compiler.ts) #angular-compiler-options (was undocumented)
The … path in file replacements does not exist. (index.ts) #file-replacement-missing, no link: the Angular CLI's own text
no ngp build found (ngp-api.ts) #no-ngp-build
… not found. Build ngp with … (ngp-api.ts) #toolchain-file-missing (was undocumented)
has no native ngp engine for … (ngp-api.ts) #no-native-engine, no link yet: #149 rewrites those lines
Failed to link … in … (linker.ts) #failed-to-link (was undocumented)
… budgets exceeded: … (budgets.ts) #budgets-exceeded
typeChecker: 'tsrs' needs the tsrs package (type-check.ts) #tsrs-not-installed
type-check failed: … (type-check.ts) #type-check-failed (was undocumented)
tsgo/tsrs exited with code … (type-check.ts) #checker-exited, no link yet: next to #138's hunk (was undocumented)
… doesn't export a reqHandler … (angular-ssr.ts) #no-req-handler (was undocumented)
… index.html is missing: the browser build has to run before the server build (angular-ssr.ts) #browser-build-first (was undocumented)
prerendering failed: + Angular rendered nothing for it (angular-ssr.ts, prerender-worker.ts) #prerendering-failed (was undocumented)
devLocale '…' is neither … (i18n.ts) #unknown-dev-locale (was undocumented)
… is not a translation file … (i18n.ts) #not-a-translation-file (was undocumented)
… says it is for locale '…'. (i18n.ts) #translation-locale-mismatch (was undocumented)
No Angular locale data for '…' (i18n.ts) #no-locale-data (was undocumented)
[locale] No translation found … (i18n.ts, from @angular/localize) #missing-translation, no link: localize's text, printed once per message
unknown format (extract.ts), unknown --duplicates (extract-cli.ts) #extract-unknown-option (was undocumented)
message extraction failed (extract.ts) #extraction-failed (was undocumented)
Not overwriting … (generate.ts) #generate-not-overwriting, no link: the other ngp-generate messages already say what to change

Not on the page because they're internal and a user can't act on them: invalid component stylesheet id, the ssr environment has no module runner, the prerender worker exited with code, the linker's FatalLinkerErrors (users see them inside Failed to link), and the parse error in linker.ts/static-defer.ts.

Corrections to the earlier draft, from checking the source:

  • NG4006 (emitDeclarationOnly) never reaches the plugin. new HybridCompiler() only checks the extendedDiagnostics options, so that bullet is gone.
  • After a crashed type-check, the last report stays up. The draft said no errors were reported.
  • The Yarn quarantine entry now says, as creating-an-app.md does, that "after each plugin release" is reasoned from one failure, not something that was run.

The bug-report link points at issues/new?template=bug_report.md. That template arrives with #165. Until #165 merges, the link opens a blank issue.

How I checked it

  • pnpm docs:check passes and counts 30 linked messages. I changed one anchor to a bad id to make sure the check fails, then put it back.
  • pnpm site:build passes. {#id} doesn't appear in the rendered HTML; it does stay in the raw .md and llms-full.txt copies, where it's harmless.
  • pnpm build, then 10 affected plugin test files (engine-option, linker, i18n, output-cache, workspace, build-options, external-libraries, angular-ssr, type-check, toolchain): 69/69 pass. engine-option.test.mjs checks the exact message text, so it now expects the link line.
  • Served site/dist/client under /vite-plugin-ngp/ and looked at the page at 1280 px in light and at 390 px in dark. The anchor links land on the right entry, and there's no horizontal scroll on a phone.

Follow-ups

Once #149 and #138 merge, add the link to the native-engine and checker-exit messages, and update the Windows wording in #no-native-engine.

🤖 Generated with Claude Code

ChristopherPHolder and others added 4 commits December 4, 2026 19:54
…rnings

One page, grouped by where you meet a message, with each heading the message as printed or a
symptom, then what it means, why, what to do, and the page with the detail. It covers the plugin's
own messages, about 19 of which the docs never mentioned, and the failure modes spread over
Status, Nx, Creating an app, Compatibility, Configuration and Testing, each linking back. It ends
with how to make a minimal reproduction and file a bug. Configuration's table of startup errors
moved here, leaving a pointer.

The markdown renderer takes `### Heading {#id}` as the heading's id, so a link from outside the
site keeps working when the heading is reworded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ting entry

Every message with an entry on the Troubleshooting page ends with a second line,
See https://push-based.github.io/vite-plugin-ngp/troubleshooting/#<anchor>, from
seeTroubleshooting(). pnpm docs:check finds every call in the plugin's source and fails when the
page has no heading with that id, and when a page names one id twice.

Left without a link: the Angular CLI's fileReplacements message and @angular/localize's missing
translations, quoted word for word, and the native-engine and checker-exit messages, which open
pull requests #149 and #138 rewrite. Decision 88 records the choice.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#169 replaced configuration#when-to-change-them with a heading per option while this branch was
open; link engine, hmr and cache to their own headings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nges on main

#149 found the wasm engine fails on Windows, and #168 renamed the Nx page's paths section. Link
the no-native-engine and checker-exit messages, now that #149 and #138 have landed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ChristopherPHolder
ChristopherPHolder merged commit 16496ae into main Dec 4, 2026
2 of 3 checks passed
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.

Docs: a Troubleshooting page, linked from the plugin's error messages

1 participant