What is tsdown?

VoidZero| 00:05:36|Mar 24, 2026
Chapters5
The chapter discusses the challenges of bundling and publishing TypeScript libraries, including configuring dual CJS/ESM formats and the misconception that ESM is the only future, while suggesting a smoother approach doesn’t have to be complicated.

Meet tsdown, a fast Rust-based library bundler that simplifies TypeScript library builds, producing ESM, CJS, and dts with ease.

Summary

VoidZero’s video introduces tsdown as the elegant, fast bundler designed for TypeScript library authors. Built atop Rolldown, tsdown offers a simplified config path that avoids juggling dozens of options. You can bundle a TS file with a single npx tsdown command, and in about 157 milliseconds you’ll get ESM plus declaration files. If you need both CJS and ESM, you can pass a format argument and obtain both outputs in just a few more milliseconds. The host explains how tsdown compares to esbuild-based tsup, highlighting better performance and features thanks to Rolldown’s Rust foundation. Anthony Fu’s ESLint config is used as a migration example, showing how easy it is to move from tsup to tsdown and gain speed—3360 ms with tsup versus 1792 ms after migrating. The video also covers how tsdown integrates with Rollup plugins and Vite’s library mode, suggesting tsdown’s ecosystem is future-proof as Rolldown becomes Vite’s default bundler. Finally, the host stresses that the migration guide is key for potential caveats, and that you’ll often see a tangible “free build speedup” with only a few minutes of effort.

Key Takeaways

  • tsdown is built on Rolldown and is designed for building libraries with a simplified configuration.
  • A simple TypeScript file can be bundled with 'npx tsdown' and produce ESM plus dts in about 157 ms.
  • Use the format argument to emit both CJS and ESM outputs in a fast follow-up run.
  • Migrating from tsup to tsdown can cut build times from 3360 ms to 1792 ms on a small library, a roughly 2x improvement.
  • tsdown is compatible with Rollup plugins and will underpin Vite's rustified library mode, ensuring long-term ecosystem cohesion.
  • the migration guide is essential to understand any caveats and to make a smooth transition.

Who Is This For?

Essential viewing for TypeScript library authors who currently use tsup or Rollup-based workflows and want a faster, simpler path. It’s also valuable for developers curious about Vite’s future library mode integration.

Notable Quotes

"tsdown is designed to make your life as library author way easier"
Intro emphasizing tsdown’s purpose for library authors.
"in just a well blazing fast 157 milliseconds we've not only bundled it in ESM but also provided the declaration files"
Demonstrating extreme speed and TS support with dts.
"tsup is the spiritual successor to tsup but while tsup is built on esbuild"
Comparison to tsup and its Esbuild foundation.
"Kevin the author of tsdown was also contributing to tsup beforehand and that tsup is no longer maintained"
Context on the ecosystem and motivation behind tsdown.
"Rolldown is compatible with the Rollup plugins"
Highlighting interoperability within the bundler ecosystem.

Questions This Video Answers

  • What is tsdown and how does it compare to tsup for TypeScript libraries?
  • How do you migrate a project from tsup to tsdown and what performance gains can you expect?
  • Can tsdown produce both ESM and CJS outputs, and how fast is the initial bundle?
  • How does Rolldown influence Vite’s library mode and plugin ecosystem?
tsdownRolldownVite library modetsupRollup pluginsRollupesbuildRustTypeScript librariesESM/CJS
Full Transcript
Bundling and publishing TypeScript libraries can  be tricky especially with all the configuration,   dual formats, if you need to publish CJS and  ESM and have heard of that otherwise ESM is   the future and of course needing a degree and  all of these but it doesn't have to be like   that so time to meet tsdown the elegant library  bundler with simplicity and speed in mind tsdown   is designed to make your life as library author  way easier let's take a look at the core features   first of all tsdown is built on top of rolldown  which is a powerful rust-based bundler and that   will also be the default in Vite soon but instead  of setting up Rolldown directly you can just take   tsdown simplified configuration optimized for  building libraries and don't have to bother with   a lot of options the best part is well to get  started you don't even need anything you don't   even need configuration to show that let's take  this very simple TypeScript file and if we want   to bundle that then all we have to run is `npx  tsdown` and then point to that file and after that   in just a well blazing fast 157 milliseconds we've  not only bundled it in ESM but also provided the   declaration files so TypeScript support if you  need something like ESM and CJS well of course   then you can pass it with the format argument  and in just a few milliseconds more you get   both the CJS and the ESM output of course there  are configuration options as you need and there's   also a watch mode to make development easier  so you can rebuild your library while actually   developing on it and thanks to Rolldown this is  pretty fast. Of course there are also other tools   out there to build your library bundle it emit  declaration files and so on so on. I think the   first that comes to mind is tsup, not only because  of the name actually tsdown is the spiritual   successor to tsup but while tsup is built on  esbuild as mentioned before tsdown is built on   Rolldown which means not only better performance  but also more features that esbuild didn't support   or were somehow baked into tsup and egoist, the  maintainer of tsup also mentioned that tsdown   is the future because Kevin the author of tsdown  was also contributing to tsup beforehand and that   tsup is no longer maintained so in terms of tsup  versus tsdown that's kind of answered but another   tool that comes to mind is Vite with its library  mode so tsdown will be used as the foundation of   Vite's rustified library mode when Rolldown will  become the default bundler in Vite itself so using   tsdown now will give you a cohesive and robust  experience in the long run as a library author   as we've talked quite a bit about Rolldown we  also have to talk about Rollup which is another   general bundler like Rolldown but it is JavaScript  based it is important to note that Rolldown is   compatible with the Rollup plugins and of course  thanks to being written rust and having other   performance improvements way faster and will also  cover features that Rollup will not include and   last but not least we have esbuild which is what  tsup used as a foundation before compared to other   bundlers as a foundation esbuild is fast because  it's written in go - not as fast as roll down   though - and also the plugin ecosystem is not as  rich as Rollups and then also Rolldowns ecosystem   with tsdown supporting Rollup Rolldown unplugin  and even some Vite plugins well that's the best   you can hope for right so all the things you might  not need to reinvent well they're just there you   can use them but after talking about various build  tools let's show how we can actually apply tsdown   instead of ts up with a quick migration and  with quick I promise you it will be fast - not   as fast as bundling your application though. As  a perfect example of a library that uses tsup and   can be migrated to tsdown easily well let's take  the ESLint config of Anthony Fu because it is a   well sculpt package it works pretty well it has  tsup installed and let's see what we can do here   before starting the migration let's actually run  a quick build and see what tsup is actually doing   here we have an install that removes the files  from before okay that shouldn't matter too much   and then also generates the dts files and we see  this roughly takes a bit more than 3 seconds so   3360 milliseconds okay that's it now let's move  over to tsdown and all you need to do is writing   pnpm dlx or npx if you want tsdown migrate. The  first prompt will be sure let's read the migration   guide very important you should check that out in  our case we can continue and then the migration   script will do its magic work and actually we  have a tsdown config now we only need to install   dependencies again with our package manager in  this case PNPM and we're good now let's look at   the changes though and see what actually happened  because the tsup config and the tsdown config they   look pretty much the same this is because well  tsdown wasn't only heavily inspired by tsup it   should also act as an almost drop-in replacement  because why not a lot of options are really good   there and should be very simple but of course  there might be some things that are different   compared to tsup. That's why the migration guide  here is very useful to read in these cases.   Vevertheless let's run a build and see how long it  will take now and we see 3360 milliseconds down to   1792 that's a 2x improvement and pretty good for  such a small library. So you see the migration   is pretty straightforward of course depending on  your library's needs there might be some caveats   um which are also cover in the migration guide.  Otherwise feel free to raise an issue as well. But   the best part is you get a free build speedup -  like literally with just a few minutes of effort.   So try it out take a look at the docs all around  here um or if you're just watching the video   from somewhere else then take a look at the docs  link in the description and try out tsdown today.

Get daily recaps from
VoidZero

AI-powered summaries delivered to your inbox. Save hours every week while staying fully informed.