Repository navigation
Replies: 1 comment
|
tsdown is designed to be the foundation for Rolldown Vite’s Library Mode, and in the future, Vite itself (currently known as rolldown-vite) will use tsdown to implement its library mode. While rolldown-vite is essentially Vite with esbuild and Rollup replaced by Rolldown, tsdown already provides several features that are missing in the current Vite and Vite-Rolldown library modes. For plugin transformations and other low-level behaviors, you can refer to Rollup’s documentation, since Rolldown shares the same API and workflow as Rollup. Also, the main difference is that Rollup uses SWC for JS parsing, while Rolldown uses Oxc for JS/TS parsing, and Oxc offers built-in capabilities that replace plugins like rollup-plugin-commonjs/node-resolve. Regarding plugin support, tsdown supports some Vite plugins. Vite plugins may work with tsdown if they don’t rely on Vite-specific internal APIs or behaviors, but plugins that depend heavily on Vite internals may not be compatible at this stage. We plan to improve Vite plugin support in the future. Notably, both In summary, tsdown is not a duplicate of Vite-Rolldown’s library mode, but rather its future foundation, with broader features and evolving plugin compatibility. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I can't find any documentation that shows how the whole ecosystem links together (i.e. what is responsible for what, how it flows from one library to the next, etc), so I'm struggling to understand where tsdown library fits in.
As I understand it:
oxcis a set of different single purpose crates for parsing, resolving, and minifying TS/JS coderolldowntakes an entrypoint file input, then uses those oxc crates to read/parse/resolve/treeshake/minify those entrypoints into a series of outputs (entrypoint+chunks+css)vite-rolldownlooks at index.html and finds the entrypoint JS/TS files, runs various plugins that modify those entrypoints (e.g. compile Vue/Svelte to TS), it passes the compiled results into rolldown, which does its thing, and vite then it writes the resulting output to disk.(obviously more complex, e.g. if vite-rolldown plugins are responsible for transforming Svelte->TS, what happens when rolldown resolver, whilst parsing a TS file, finds a Svelte file as an import? It must send it back up to vite-rolldown, which then compiles it into TS, then sends the TS back down to rolldown to keep going? Would love if the docs has an ecosystem diagram showing how this all works)
Anyway, in a normal project, it would seem that you would not need to worry about oxc or rolldown directly, you would use vite-rolldown to configure things, and run
vite buildto get everything you need. Vite also has library mode, that takes the entrypoint files directly, instead of searching for them in index.html.Assuming I haven't completely misunderstood anything, where does tsdown fit in? It seems like it would duplicate vite-rolldown's library mode, that is, it takes JS/TS entrypoints, passes them to rolldown, and writes the resulting outputs to disk?
But according the docs, it supports rollup plugins, but not vite plugins. So if a person has for example Vue/Svelte files in their library, they wouldn't be able to use tsdown? What are the reasons a person would use tsdown over vite-rolldown library mode?
All reactions