TanStackT
TanStackโ€ข3mo agoโ€ข
5 replies
popular-magenta

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:

const routes = ["/", "/foo", "/bar", "/baz"]

export const routes = rootRoute(
  "templates/root.tsx",
  routes.map((path) => route(path, "templates/page.tsx")),
)


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:
error during build:
[tanstack-start:start-manifest-plugin] Could not load tanstack-start-manifest:v (imported by node_modules/.pnpm/@tanstack+start-server-core@1.133.20/node_modules/@tanstack/start-server-core/dist/esm/loadVirtualModule.js): Cannot read properties of undefined (reading 'routes')
    at โ€ฆ


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
Contribute to carloitaben/repro-tanstack-start-serve-manifest development by creating an account on GitHub.
GitHub - carloitaben/repro-tanstack-start-serve-manifest
Was this page helpful?