Important
This is a minor release. It adds experimental import defer support and includes a few changes to default behavior. Please read Breaking changes before upgrading.
๐ Experimental import defer support
Rolldown now supports deferred module evaluation via import defer and import.defer(). Enable it with experimental.importDefer:
// rolldown.config.js
export default {
experimental: {
importDefer: true,
},
};A deferred module is bundled as usual, but it is only evaluated when its namespace is first accessed:
import defer * as heavy from './heavy.js';
console.log('start');
console.log(heavy.value); // heavy.js is evaluated hereWith the option off, import defer is compiled to a regular import with a warning, same as before. The same happens when a build contains a pattern that Rolldown can't defer yet, and the warning tells you why. Dev mode and Vite are not supported yet. See the experimental.importDefer docs for details.
โ ๏ธ Breaking changes
experimental.nativeMagicString has been removed (#11961)
Native MagicString is now always enabled, and meta.magicString is now also available in renderChunk hooks. Remove the option from your config to avoid the invalid option warning.
Built-in plugins from a different Rolldown version now throw an error (#11991)
Previously, a built-in plugin (e.g. dynamicImportVarsPlugin()) created by another copy of rolldown was silently ignored. Plugins from another copy of the same version now work as expected, while plugins from a different version throw a BUILTIN_PLUGIN_VERSION_MISMATCH error. If you hit this error, make sure only one version of rolldown is installed.
Plugins created by rolldown 1.3.4 or earlier are still ignored, as they don't carry version information.
require() of a bundled ES module now returns the same object (#11818)
Repeated require() calls to the same bundled ES module now return the same object, matching Node.js, Rollup and webpack. Previously, each call created a new object.
const a = require('./esm.mjs');
const b = require('./esm.mjs');
a === b; // false in 1.3.4, true in 1.4.0[1.4.0] - 2026-12-02
๐ Features
- cjs: return the same object from repeated
require()of a bundled ES module (#11818) by @hyfdev - add experimental persistent scan cache (#11671) by @h-a-n-a
- keep the deferred evaluation of
import deferwith external modules and in all output formats (#11868) by @IWANABETHATGUY - keep the deferred evaluation of
import.defer()(#11867) by @IWANABETHATGUY - types: expose
TransformExtraOptions(#12012) by @sapphi-red - keep the deferred evaluation of
import deferin builds with more than one chunk (#11866) by @IWANABETHATGUY - keep the deferred evaluation of
import deferin import cycles (#11865) by @IWANABETHATGUY - keep the deferred evaluation of
import deferwith top-levelawait(#11864) by @IWANABETHATGUY - keep the deferred evaluation of
import deferfor CommonJS and JSON modules (#11863) by @IWANABETHATGUY - keep the deferred evaluation of
import deferin one-chunk builds (#11862) by @IWANABETHATGUY - add
experimental.importDefer(#11861) by @IWANABETHATGUY - enable
experimental.nativeMagicStringby default and remove the option (#11961) by @sapphi-red - rolldown_plugin_vite_dynamic_import_vars: add support for import attributes (#11930) by @sapphi-red
- rolldown_plugin_vite_import_glob: add
withoption (#11929) by @sapphi-red - output: expose
immutableon chunks and assets (#11978) by @hyfdev
๐ Bug Fixes
- rolldown_plugin_vite_import_glob: read
importandqueryoptions given as template literals (#12057) by @shulaoda - watch: do not ignore
close()called before theoptionshooks resolve (#11877) by @lazerg - recognize built-in plugins from another copy of rolldown (#11991) by @shulaoda
- code-splitting: avoid unsettled top-level await when a grouped module imports an unused side-effect-free entry (#11949) by @hyfdev
- dev: reload instead of panicking when the HMR stage has no snapshot (#12020) by @h-a-n-a
- look up inlined enum members by symbol, not by name (#11981) by @shulaoda
- dev: emit native build warnings via
onLoginDevEngine(#12011) by @semanym - preserve module evaluation order with
import defer(#11950) by @IWANABETHATGUY - transform: handle process without cwd (#11957) by @akshathayadav378-boop
- dev/lazy: skip the scan on a repeat visit and the rebuild after a lazy compile (#11338) by @h-a-n-a
- output: keep
immutablewhengenerateBundleedits content (#11982) by @hyfdev - keep the namespace of a dynamic import read before its declaration (#11984) by @shulaoda
- don't resolve a property of an ESM binding to a CommonJS export (#11985) by @shulaoda
- keep all exports of a CommonJS module required beside a re-export (#11986) by @shulaoda
- import-attributes: handle
__proto__consistently (#11934) by @sapphi-red - rolldown_plugin_vite_dynamic_import_vars: warn on invalid attributes in variable dynamic imports (#11933) by @sapphi-red
- rolldown_plugin_vite_dynamic_import_vars: include source locations in deprecated import assertion warnings (#11932) by @sapphi-red
- import-attributes: respect dynamic import option precedence (#11931) by @sapphi-red
- watch: run
closeBundleonce after a build error (#11976) by @hyfdev - dev: avoid duplicate external import bindings in HMR payloads (#11889) by @h-a-n-a
๐ Refactor
- declare native JSON module size through
declared_module_size(#11948) by @hyfdev - ls_lint: replace globset with globstar (#12009) by @shulaoda
๐ Documentation
- clarify that ES5 output is not supported (#12053) by @sapphi-red
- add jsdoc to magic-string propeties and methods (#12015) by @sapphi-red
- clarify side-effect-free module behavior (#11908) by @sapphi-red
- types: mark magic-string properties on hook options as experimental (#12013) by @sapphi-red
definein CJS modules (#11960) by @sapphi-red
โก Performance
- dev/lazy: leave fetched lazy routes out of full builds (#12029) by @mattlewis92
- store the runtime helpers of a module in one list (#12032) by @shulaoda
- plugin: cut per-call work in JS plugin hook calls (#12037) by @Dunqing
- report output external memory to V8 in one adjustment (#12034) by @Dunqing
- use a plain set for the transform dependencies of a module (#12030) by @shulaoda
- print each module right after it is finalized (#12027) by @shulaoda
- write output files in parallel and create each directory once (#11680) by @Boshen
- rolldown_utils: reuse the escaped string in
to_ecma_string_literal(#12021) by @g4lb - avoid allocating paths for source reads (#12018) by @IWANABETHATGUY
- run the private modules of a deferred module in its init wrapper (#11869) by @IWANABETHATGUY
- string_wizard: build
hires: falsesourcemap segments one line at a time (#11996) by @g4lb
๐งช Testing
- persistent-cache: use slash-normalized ids for the import-glob test on Windows (#12031) by @shulaoda
โ๏ธ Miscellaneous Tasks
- deps: update rollup submodule for tests to v4.69.1 (#12022) by @rolldown-guard[bot]
- deps: update test262 submodule for tests (#12023) by @rolldown-guard[bot]
- deps: upgrade oxc to 0.161.0 (#12019) by @camc314
- deps: update rust crates (#12006) by @renovate[bot]
- deps: update npm packages (#12005) by @renovate[bot]
- deps: update github actions (#12007) by @renovate[bot]
- deps: update dependency rust to v1.100.1 (#11997) by @renovate[bot]
- deps: update napi (#11892) by @renovate[bot]
- release: fix crates publish failing on the
rolldown_testingdev-dependency (#11979) by @shulaoda - deps: update rust crate oxc_sourcemap to v10.0.1 (#11977) by @renovate[bot]
โค๏ธ New Contributors
Co-authored-by: shulaoda 165626830+shulaoda@users.noreply.github.com