Building dynamic routes from remote data (start-manifest-plugin error)
Hello! Iām tinkering with Start to free my team from Next.js š
I want to programmatically create routes based on data from a remote service, such as a CMS, using the same page template for every route.
Initially, I attempted this with virtual file routes:
but without the
verboseFileRoutes option, the createFileRoute path argument gets replaced in an infinite loop (React Router v7 solves this problem by passing an unique id per route).
I am now trying to disable route generation and manually build the route tree. This approach works wonderfully during development but fails during builds with:
I left a repro here with my setup: https://github.com/carloitaben/repro-tanstack-start-serve-manifest
Is there any other way of achieving this without having to create route files?GitHub
GitHub - carloitaben/repro-tanstack-start-serve-manifest
Contribute to carloitaben/repro-tanstack-start-serve-manifest development by creating an account on GitHub.
3 Replies
stormy-goldā¢2mo ago
you cannot reuse a file like that
this however sounds like it could just be a path param instead of individual routes?
adverse-sapphireOPā¢2mo ago
Yeah, that's a good idea, it simplifies the whole setup š¤
Let me provide some additional context for clarification.
The CMS at my job defines the frontend routes as follows:
This object creates the following routes:
-
en.tsx and fr.tsx
- en.news.$id.tsx and fr.nouvelles.$id.tsx
I need to find the route configuration based on the path. The configuration is used as follows:
- cache: boolean indicates whether the route should return cacheable Cache-Control headers.
- endpoint: string specifies where to fetch data for rendering the page content.
Initially, I thought about implementing a catch-all route and using the request URL to match some of my routes. However, I'm concerned that this approach might create one large bundle for every route instead of separate bundles for each route. Does Router provide an API to simplify route matching? Perhaps I can resolve this by using path-to-regexp.stormy-goldā¢2mo ago
i dont see how the above helps with bundle size
where are the locales encoded?