Turbopack Persistent Caching

This ad is not shown to multipass and full ticket holders
React Summit US
React Summit US 2025
November 17 - 21, 2025
New York, US & Online
The biggest React conference in the US
Learn More
In partnership with Focus Reactive
Upcoming event
React Summit US 2025
React Summit US 2025
November 17 - 21, 2025. New York, US & Online
Learn more
Bookmark
Rate this content

FAQ

Tobias Koppers works for Vercel at the TurboPack team.

The main goal for TurboPack's development was to achieve instant builds and focus on incremental build performance.

Persistent caching is important for TurboPack to ensure that builds are incremental and efficient, even after process restarts.

TurboPack focuses on bottom-up caching and incremental build performance, unlike other tools that often use top-down caching.

TurboEngine is the caching engine that powers TurboPack, enabling granular caching and automatic cache invalidation.

TurboPack automatically tracks dependencies and invalidates caches only for changes that affect specific nodes in the dependency graph.

TurboPack plans to become a general-purpose bundler, making it easier to integrate with frameworks beyond Next.js.

No, TurboPack and TurboRepo are independent tools with different purposes and should not be confused.

Persistent caching introduces challenges such as process restarts, environment changes, and the need for granular cache invalidation.

Initial build times were initially slow due to large data dumps, but improvements in database and caching strategies have mitigated this issue.

Tobias Koppers
Tobias Koppers
29 min
12 Jun, 2025

Comments

Sign in or register to post your comment.
Video Summary and Transcription
Tobias Koppers from Vercel TurboPack team discusses implementing persistent caching for long-term web application development, foreseeing significant growth in application sizes over the next decade. AI's role in code writing, TurboPack's vision for instant builds, challenges in build control, and the shift to incremental performance with caching for faster builds. TurboPack emphasizes making incremental builds fast and every build incremental, focusing on trustable and granular incremental builds, efficient granular cache handling in TurboEngine, and automatic granular cache invalidation. The system optimizes performance through efficient persistent cache integration, graph state persistence, database optimization, custom persistent layer creation, and optimizing build time efficiency. TurboPack stands out with its unique bottom-up caching approach, expansion to a general purpose bundler, and plans to enhance framework compatibility. Additionally, the comparison with ESBuild highlights the emphasis on incremental builds and detailed cache granularity with a token-based, almost AI-like approach.
Available in Español: Turbopack Persistent Caching

1. Tobias Koppers on TurboPack and Persistent Caching

Short description:

Tobias Koppers from Vercel TurboPack team discusses implementing persistent caching for long-term web application development, foreseeing significant growth in application sizes over the next decade.

My name is Tobias Koppers and I work for Vercel at the TurboPack team. And I want to talk to you about the story about persistent caching that we implemented for TurboPack. So when we started working on TurboPack, we wanted to build something for the next 10 years. So we first reflected on the last 10 years of web development, and we noticed that web applications have grown really much. Like 10 years ago, some people even used normal script text and didn't even use a bundler on web dev, or used Grunt or Gulp to concatenate stuff. So now we extrapolate that for the next 10 years. We'll see web applications will be enormous in size, and that will be a problem.

2. AI's Impact on TurboPack Build Vision

Short description:

AI's role in code writing, TurboPack's vision for instant builds, challenges in build control, and the shift to incremental performance with caching for faster builds.

And we made this thing basically two years ago, and now if you look at this retrospectively, it makes much more sense. Because now you see AI is writing all of the code, and you can expect AI will write a lot of more code in the next 10 years. So it kind of makes sense. But we also had this goal of instant builds for TurboPack. We had this vision that nobody should ever wait for a build to finish. You basically should push your code, and instantly you can directly share that code in the preview deployment or the finished build with your coworkers. Or even AI pushes code and wants to directly share it with you in kind of a feedback loop.

So this is a little bit in contrast with each other, and there are even more problems with that. We can't even control all of the build process. We want to allow custom plugins, custom transformations, like webpack loaders, or we can't even control the user code and all the NPM libraries they throw at us. So with all of that, we can still use Rust to write native code, just parallelism to use other cores, but that won't help us with all these problems. Because if there is something slow in a custom plugin or in a webpack loader or in anything we don't have control of, that will break our goal of instant builds.

Our approach was we wanted to change the focus. Instead of focusing on raw build performance, we wanted to focus on incremental build performance. So we maybe have to accept that some stuff is slow in the initial build, but we can at least make sure that we don't ever re-execute it again. We basically make it faster than all the other builds, all the incremental builds. And in fact, in practice, nearly every build can have a cache. On local development and dev server or something, you can have an accessible disk, we can store stuff there, we can cache stuff. And even on CI builds, nearly all good CI providers have the ability, the infrastructure to provide you with some caching capabilities. So we can use the cache. That's great.

QnA

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

The Core of Turbopack Explained (Live Coding)
JSNation 2023JSNation 2023
29 min
The Core of Turbopack Explained (Live Coding)
Tobias Koppers introduces TurboPack and TurboEngine, addressing the limitations of Webpack. He demonstrates live coding to showcase the optimization of cache validation and build efficiency. The talk covers adding logging and memorization, optimizing execution and tracking dependencies, implementing invalidation and watcher, and storing and deleting invalidators. It also discusses incremental compilation, integration with other monorepo tools, error display, and the possibility of a plugin system for Toolpag. Lastly, the comparison with Bunn's Builder is mentioned.
Rome, a Modern Toolchain!
JSNation 2023JSNation 2023
31 min
Rome, a Modern Toolchain!
Top Content
Rome is a toolchain built in Rust that aims to replace multiple tools and provide high-quality diagnostics for code maintenance. It simplifies tool interactions by performing all operations once, generating a shared structure for all tools. Rome offers a customizable format experience with a stable formatter and a linter with over 150 rules. It integrates with VCS and VLSP, supports error-resilient parsing, and has exciting plans for the future, including the ability to create JavaScript plugins. Rome aims to be a top-notch toolchain and welcomes community input to improve its work.
Server Components with Bun
Node Congress 2023Node Congress 2023
7 min
Server Components with Bun
Top Content
Bun is a modern JavaScript runtime environment that combines a bundler, transpiler, package manager, and runtime. It offers faster installation of NPM packages and execution of package.json scripts. Bun introduces a new JavaScript and TypeScript bundler with built-in support for server components, enabling easy RPC with the client. This allows for code splitting and running code that streamingly renders React or any other library from the server and mixes it with client code, resulting in less JavaScript sent to the client.
Challenges for Incremental Production Optimizations
JSNation 2024JSNation 2024
32 min
Challenges for Incremental Production Optimizations
TurboPack is a new bundle similar to Webpack, focusing on incremental builds to make them as fast as possible. Challenges in production builds include persistent caching, incremental algorithms, and optimizing export usage. The compilation process can be split into parsing and transforming modules, and chunking the module graph. TurboPack aims to achieve faster production builds through incremental optimization and efficiency. Collaboration and compatibility with other ecosystems are being considered, along with the design of a plugin interface and tree-shaking optimization.
Parcel 2: the Automagical Bundler
DevOps.js Conf 2021DevOps.js Conf 2021
8 min
Parcel 2: the Automagical Bundler
Parcel 2 is a ground-up rewrite of Parcel 1, a fast and scalable zero-configuration web application bundler used by large companies like Atlassian and Adobe. It offers a zero-config approach with good defaults, making it production-ready out of the box. The new features include a revamped plugin system, a configuration file, transformers for file conversion, optimizers for code compression, target support for different browsers, diagnostics for error debugging, and named pipelines for data and JavaScript in different formats. Parcel 2 also supports different import scenarios, such as importing JSON files with named pipelines and using query parameters for image optimization. It includes various performance improvements, stable caches, optimized data structures, enhanced code splitting and bundling, improved scope hosting, and better support for monorepos and libraries. A React example is provided to showcase the simplicity of Parcel and how to use it with React.
Bundlers: A Deep Dive into Modern JavaScript Build Tools
JSNation 2025JSNation 2025
20 min
Bundlers: A Deep Dive into Modern JavaScript Build Tools
Edoardo, DevRel at Storyblok, explains the importance of JavaScript bundlers and discusses Storyblok's migration to Vite. Challenges with old JavaScript applications are illustrated, emphasizing issues with global variables and dependency control. Optimizing JavaScript module loading through ES modules is discussed, highlighting browser compatibility and performance concerns. The process of creating and structuring JavaScript bundles is detailed, focusing on dependency graphs and module organization. Techniques for managing bundle execution, utilizing abstract syntax trees for code parsing, and implementing optimization strategies are explored, with a specific emphasis on Vite, hot module replacement, and development enhancements.