npm rolldown 1.4.0
v1.4.0

2 hours ago

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 here

With 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

๐Ÿ› Bug Fixes

  • rolldown_plugin_vite_import_glob: read import and query options given as template literals (#12057) by @shulaoda
  • watch: do not ignore close() called before the options hooks 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 onLog in DevEngine (#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 immutable when generateBundle edits 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 closeBundle once 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

โšก 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: false sourcemap 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_testing dev-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

Don't miss a new rolldown release

NewReleases is sending notifications on new releases.