Expand description
rolldown bundle + tree-shake + TypeScript -> one ESM module ->
compiled to QuickJS bytecode once.
rolldown (built on oxc) resolves the whole import graph including
node_modules, transpiles .ts/.tsx, tree-shakes, and emits a
single ESM chunk. That chunk is compiled to bytecode a single time;
every realm that runs it links the bytecode (one Module::load, no
parse, no resolver). A hidden source map is kept so a JS error in
the bundled output is reported at the original .ts/.js location.
The native modules a realm serves stay EXTERNAL: the chunk keeps the
bare import ... from 'node:fs' and the written bytecode re-links by
name against whatever realm loads it. The Bundler reads which
specifiers those are from the same ModuleRegistry the runtime
was built with, so the two cannot disagree.
Structs§
- Bundled
Source - The result of one rolldown bundle.
- Bundler
- The bundle front-end for one runtime configuration: its options, the module table whose specifiers stay external, and the cache its compiles land in.
- Bundler
Options - How a bundle resolves: shim aliases, inline virtual modules, the module resolution controls and the tsconfig selection.
Functions§
- is_
typescript_ path - True when a path’s extension marks it as TypeScript (
.ts/.tsx/.mts/.cts) and so must be transpiled through the bundler. - source_
is_ es_ module - Heuristic: the source begins a line with a static
import/exportand so must run as an ES module (bundled). Dynamicimport(...)is intentionally NOT matched — it is valid in a plain script, so such a script keeps top-levelreturn. A false positive only costs an unnecessary bundle, never wrong output.