You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The file-based route generator can detect an invalid route candidate, warn that it does not export Route, omit it from the route tree, and still let the build exit successfully.
For example, adding a non-route helper without the configured ignore prefix:
src/routes/book/onAppointmentCreated.ts
produces:
Warning: Route file ".../onAppointmentCreated.ts" does not export a Route. This file will not be included in the route tree.
The warning is useful, but CI cannot currently make this condition blocking through supported configuration. A merge request can therefore pass even though the generator discarded a route candidate.
This was observed with:
@tanstack/react-start@1.168.27
@tanstack/react-router@1.170.17
resolved @tanstack/router-generator@1.167.18
Vite 8.1.3
Proposed capability
Add an opt-in generator configuration such as:
{
"failOnWarning": true
}
The default should remain false for backward compatibility. When enabled, a warning emitted by route generation should make generation/build fail with a nonzero exit status.
Because the behavior originates in @tanstack/router-generator, defining the option at the generator level would allow the Router CLI, Router build plugins, and TanStack Start integrations to expose consistent behavior.
Why this is useful
Projects that treat route generation as a build invariant could enable the option in CI and locally. In particular, a candidate file that is silently omitted from the generated route tree would become a blocking failure instead of log output that is easy to miss.
Alternatives considered
Reimplement route discovery in an application-specific validation script. This duplicates TanStack Router's ignore-prefix, ignore-pattern, file classification, and export-detection behavior and can drift from the real generator.
Capture build output and match warning text. This depends on human-readable warning text and subprocess behavior.
Invoke Generator directly and intercept console.warn. This uses the real generator but requires a direct tooling dependency and global console interception because the generator logger is not injectable.
Use Vite/Rollup warning hooks. The route generator currently emits this diagnostic through console.warn, so it does not reliably flow through Vite/Rollup warning hooks.
A supported failOnWarning option would keep validation with the component that owns route discovery and diagnostics.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Problem
The file-based route generator can detect an invalid route candidate, warn that it does not export
Route, omit it from the route tree, and still let the build exit successfully.For example, adding a non-route helper without the configured ignore prefix:
produces:
The warning is useful, but CI cannot currently make this condition blocking through supported configuration. A merge request can therefore pass even though the generator discarded a route candidate.
This was observed with:
@tanstack/react-start@1.168.27@tanstack/react-router@1.170.17@tanstack/router-generator@1.167.188.1.3Proposed capability
Add an opt-in generator configuration such as:
{ "failOnWarning": true }The default should remain
falsefor backward compatibility. When enabled, a warning emitted by route generation should make generation/build fail with a nonzero exit status.Because the behavior originates in
@tanstack/router-generator, defining the option at the generator level would allow the Router CLI, Router build plugins, and TanStack Start integrations to expose consistent behavior.Why this is useful
Projects that treat route generation as a build invariant could enable the option in CI and locally. In particular, a candidate file that is silently omitted from the generated route tree would become a blocking failure instead of log output that is easy to miss.
Alternatives considered
Generatordirectly and interceptconsole.warn. This uses the real generator but requires a direct tooling dependency and global console interception because the generator logger is not injectable.console.warn, so it does not reliably flow through Vite/Rollup warning hooks.A supported
failOnWarningoption would keep validation with the component that owns route discovery and diagnostics.Beta Was this translation helpful? Give feedback.
All reactions