
Working on Turbopack at @vercel https://xitter.cf/t.co/2hqvlMyVU8
- Tweets1.8K
- Following2.2K
- Followers496
- Likes10.5K
Making Turbopack Fast
Next.js Conf 2025

ALT Screenshot of code sample: $ parcel server.tsx // server.tsx import express from 'express'; import {renderRequest} from '@parcel/rsc/node'; import {Page} from './Page'; const app = express(); app.get('/', async (req, res) => { await renderRequest(req, res, <Page />); }); app.listen(3000); // Page.tsx "use server-entry"; export function Page() { return ( <html> <body> <h1>Hello world!</h1> <Client /> </body> </html> ); }

ALT Caterpie capabilities Minimizing work Minimizing work is important to ensure a great developer experience. When iterating locally you don’t want to be hit with large rebuild times. To this end there were a few areas we explored: Building a granular code dependency graph — a lot of the code is generated, meaning it doesn’t exist on the filesystem. When you edit a file it should invalidate the smallest part of that graph as possible to keep HMR fast. Separating data from routes — sometimes routes need to be ordered, if the data for ordering is within the route itself it ends up being an expensive operation when updating it. Instead we move this data out and into optional _meta.json files. Code dependency graph? Imagine a given module that imports other modules. And then those modules import other modules. If we granularly chunk up code across many modules instead of a single module when code changes we only pay for a subset of the graph rebuilding rather than everything.
![File system router
At its core Caterpie is a file system router built with Parcel plugins and react-resource-router. We source routes from both the routes folder and also from workspace packages. Given a file tree that looks like:
/packages/button/docs
/examples.mdx
/website
/routes
/foo.mdx
We build up a static routes array that lazy loads every route, passing it to react-resource-router. Every file is a route.
const FooMdx = lazy(() => import('./websites/routes/foo.mdx'));
const ButtonDocsExamplesMdx = lazy(() => import('../packages/button/docs/examples.mdx'));
const routes = [
{ component: ButtonDocsExamplesMdx, path: "/docs/button/examples", exact: true },
{ component: FooMdx, path: "/foo", exact: true },
];
<Router routes={routes} />
Consumers don’t do any wiring up as it’s all handled by Caterpie — including bootstrapping the React app itself — so we have a lot of leverage to improve this for everyone over time.](https://pbs.twimg.com/media/GJql5MlbwAAjhn7.jpg?name=small&format=webp)
ALT File system router At its core Caterpie is a file system router built with Parcel plugins and react-resource-router. We source routes from both the routes folder and also from workspace packages. Given a file tree that looks like: /packages/button/docs /examples.mdx /website /routes /foo.mdx We build up a static routes array that lazy loads every route, passing it to react-resource-router. Every file is a route. const FooMdx = lazy(() => import('./websites/routes/foo.mdx')); const ButtonDocsExamplesMdx = lazy(() => import('../packages/button/docs/examples.mdx')); const routes = [ { component: ButtonDocsExamplesMdx, path: "/docs/button/examples", exact: true }, { component: FooMdx, path: "/foo", exact: true }, ]; <Router routes={routes} /> Consumers don’t do any wiring up as it’s all handled by Caterpie — including bootstrapping the React app itself — so we have a lot of leverage to improve this for everyone over time.

ALT Code example importing the regexgen library, calling the function with a list of strings, and storing the returned regex in a constant. Then console.logging it. The compiled bundle shows a console.log with a pre-compiled regex, and the import of regexgen completely removed. See the linked blog post for the full code.



















