npm / rollup
rollup
What changed in rollup 2 to 4, from its official release notes, upgrade guides and advisories. Also covers @rollup/rollup-darwin-arm64, @rollup/rollup-darwin-x64, @rollup/rollup-linux-arm64-gnu, @rollup/rollup-linux-arm64-musl, @rollup/rollup-linux-x64-gnu, @rollup/rollup-linux-x64-musl, @rollup/rollup-win32-arm64-msvc, @rollup/rollup-win32-x64-msvc. Sources checked 2026-12-04.
81 breaking1 security21 deprecations15 new APIs and options5 performance29 behavior and defaults2 tooling80 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initrollup 4134 changes
Breaking changes 32
Deeply nested expressions now fail the build with a parse error instead of causing a native stack overflow.
Rollup now fails if generated file names would write outside the target directory using Windows drive-relative paths.
Deleting or reassigning namespace members now produces catchable runtime errors, and namespace property references are preserved in delete expressions.
Dynamic chunks for index.js files use the directory name instead of "index".
The build-only optional dependency is no longer published, avoiding an unnecessary optional dependency on Linux.
Rollup throws if the generated bundle contains paths that would leave the output directory.
The acorn option has been removed.
This configuration option is no longer available, so it can no longer be used to add plugins for unsupported syntax.
Acorn plugins are no longer supported, and this option has been removed.
The plugin interface replaces “assertions” with “attributes” in various places.
Import attributes use the
attributesfield in theresolveIdhook and other places, replacingassertions.The browser build now relies on a WASM artifact that must also be provided.
Generated file hashes now use URL-safe base64 encoding.
File names now use url-safe base64 hashes instead of base16 hashes; hash length is limited to at most 21 characters.
The abstract syntax tree representation of import attributes now follows the ESTree spec again.
This option was removed from input options; use the corresponding output option.
This error code was replaced with INVALID_IMPORT_ATTRIBUTE.
Watch mode no longer watches ids of files loaded through a plugin load hook; plugins must call
this.addWatchFile()for files they depend on.The maximum hash length is now 22 characters.
Rollup automatically installs and removes native code as an optional npm dependency on supported platforms and architectures; unsupported systems receive an error listing supported platforms and architectures.
The minimum required Node version is now 18.0.0.
Normalized input options provided by hooks no longer contain an onwarn handler; plugins should use onLog instead.
When using the browser build with Vite, add
@rollup/browserto this setting to avoid an invalid WASM file path when running the dev server.This output option was removed; use the renderDynamicImport plugin hook instead.
This option was removed because Rollup now always runs the full chunking algorithm.
This output option was removed; use output.generatedCode.symbols instead.
This output option was removed; use output.generatedCode.constBindings instead.
When a plugin load hook handles a module id corresponding to a real path, Rollup no longer watches the actual file; plugins must call this.addWatchFile for dependency files when needed.
The RollupWarning type was removed in favor of RollupLog.
Plugins should no longer access this property; use
this.getModuleIds()instead.this.parse now only supports the allowReturnOutsideFunction option for now.
The default value of the skipSelf option is now true.
Security 1
Rollup 4 has Arbitrary File Write via Path Traversal
Deprecations 2
Returning import attributes from load or transform hooks is deprecated and will no longer be supported with Rollup 5.
This option is deprecated in favor of output.externalImportAttributes.
New APIs and options 4
Rollup supports source phase imports as long as they are external.
Import attributes are now available in plugin hooks that did not provide them before.
The parser is exposed as a separate export named parseAst.
Users on platforms unsupported by the optional native binary can use this package, which has the same interface as Rollup and relies on WASM artifacts.
Performance 4
Rendering ES output is slightly faster by avoiding repeated export name scans when rendering ES chunks.
Unused Symbol.hasInstance, Symbol.dispose and Symbol.asyncDispose properties can now be tree-shaken.
Caching generated variable names improves rendering performance.
Rollup switches to a native SWC-based parser to improve parsing speed.
Behavior and default changes 12
Cached sourcemaps are used when available when reading cached files.
Namespace members accessed through default exports can now be tree-shaken.
Supports synthetic named exports in namespaces when preserving modules.
Try-catch deoptimization now covers calling methods on objects, retaining callbacks of helper methods called from try statements.
Rollup can analyze function return values in more cases, which may affect build-time analysis.
Static dependencies shared between manual chunks and entry points are extracted into separate chunks.
Entry modules are sorted to make chunk hash names deterministic.
Rollup also supports the annotation before variable declarations that declare function expressions.
Rollup tracks object property inclusions of dynamic namespace members.
Import assertions now use the new import attribute AST structure.
Rollup now warns when this annotation appears in an invalid location.
If an entry module starts with a shebang comment, it is prepended to output for es and cjs formats.
Tooling 1
Adds an android-x64 native build, extending Rollup support to X64 Android.
Fixes and other changes 78
Reverts a previous fix that was breaking bundling in certain cases.
Properly preserves
thisin JSX member expressions.Rebuilds with the latest content when a watched file changes in quick succession on Linux and Windows.
Dynamic imports resolved via plugins are now handled equivalently to regular dynamic imports.
Mutations of arguments exposed through the return values of certain known global methods are now respected in analysis.
Rollup no longer assumes it knows an array’s contents when its length has been reassigned.
Fixes generated code for assignments and exported declarations in loops and single-statement bodies.
Improves namespace object generation in cyclic imports, including namespace bindings initialized later in a cycle.
Fixes invalid generated code when non-ESM output exports destructuring declarations with defaults.
Names beginning with a literal * are no longer confused with internal namespace import placeholders.
A shared module accessed through different dynamic imports is no longer wrongly merged into the first.
Chunk hashes now change when debug IDs are enabled or disabled.
Honors output.sourcemapFile when output.file is not set.
Rollup works again on older Xeon processors by building linux-x64-gnu C code for baseline x86-64 CPUs.
Line breaks in module ids are now handled correctly in imports.
Index sourcemaps returned by plugins are flattened.
Null sources in plugin-generated sourcemaps are treated as unmapped.
Rendering errors are preserved when the renderError hook fails.
Tree-shaking now respects Symbol.dispose for async disposal.
Forwards startup errors that occur while loading native modules when starting Rollup.
Fixes wrong log-location segments when sourcemaps are unaligned.
Global or sticky regular expressions used for file names are now handled consistently.
Logs from transform hooks at position 0 can now be generated.
Properly decodes HTML entities in JSX output.
Avoids breaking lazy loading when a dynamic import only contains reexports from a manual chunk.
Live-bindings are now properly maintained for aliased exports.
Typed array constructor calls are retained when their argument has iteration side effects.
Chunk hashes now change when sourcemap comments change, avoiding stale hashes when those comments are modified.
Fixes some relative import resolution edge cases, matching Node's join and relative behavior for "." and ".." segments in the browser.
Fixes watching not-yet-created files from plugins when several share a directory.
Side effects in class instance field initializers are retained when instantiating a class, avoiding incorrect tree-shaking.
Detection now recognizes top-level asynchronous for...of loops and async disposal.
Prevents cycles when using indirect top-level await for dynamic imports.
The Rollup WASM build is supported on big-endian hosts.
Fixes a performance regression when bundling code with deeply nested property calls.
When build errors occur, errors from closeBundle no longer replace them.
Certain CoreJS helpers are no longer wrongly tree-shaken.
Fixes cases where some core-js feature-detections were not triggering properly.
External re-exports used in a reified dynamic namespace are now always imported.
Watch mode now terminates when closed via Ctrl+C instead of hanging.
Watch mode no longer starts overlapping runs when plugins invalidate files at the wrong time.
Watch mode events are now emitted to listeners correctly in edge cases, especially when errors occur.
Quotes and backslashes in import attribute values are escaped so Rollup does not generate invalid code.
Cached module meta information is now exposed in shouldTransformCachedModule, allowing plugins to access it during cache checks.
The browser shims for basename and extname now fully match NodeJS.
Tree-shaking respects Windows line terminators when removing line breaks needed to prevent automatic semicolon insertion.
Failures on invalidation are always reported and recovered from in watch mode.
Fixes filtering logs by nested properties via the CLI when those properties have primitive values.
Function return value tracking was reverted until the most recent issue is understood.
Fixes invalid module concatenations that could result from compact mode.
Resolves a regression when using Rollup on older Linux distributions and enforces glibc ≤ 2.28 compatibility.
Illegal characters in the preserved modules input base are sanitized before computing preserved module chunk names.
When using minChunkSize with hoisting disabled, Rollup no longer adds spurious side-effect-free external imports to chunks.
Fix an issue where getLogFilter would match additional logs.
Preserve multipart file extensions when deconflicting output chunks by inserting conflict numbers before the first extension.
Avoids extraneous newlines when adding headers via plugins.
Fixes a rare issue where starting Rollup would hang on Windows.
Chunk assignment is stabilized across parallel file reads, improving the stability of chunk hashes.
Fixes variable rendering when generating different formats from the same build.
Fixes a caching issue that could cause side effect imports to be dropped.
Fixes a crash when using lazy dynamic imports with moduleSideEffects:false.
Ensures exports of a dynamic import are fully included when called from a try...catch.
Fixes a heap corruption issue on Windows.
Rollup handles methods that access dynamically imported namespace members via this.
Fixes the semicolon insertion position in JSX variable declarations.
Manual chunks are sorted by module execution order to reduce circular dependency issues.
Fixes the artifact reference for OpenBSD, so developers can use the correct release artifact.
Namespace properties referenced only from a try-catch are included.
Well-known-Symbol-valued properties are no longer tree-shaken except in select cases.
Fixes the semicolon insertion position when using JSX.
Generates spec-compliant sourcemaps when sources content is excluded by setting sourcesContent to undefined instead of null.
Rollup no longer removes Symbol.asyncDispose properties with (await) using declarations.
Rollup no longer removes Symbol.dispose properties with (await) using declarations.
Fixes assignments being wrongly tree-shaken when they mutate a value.
Fixes an error that flagged too many modules as having an unused external import.
Rollup no longer throws when using invalid escape sequences in template literals.
Sourcemap debugIds are now always valid UUIDs, avoiding invalid-length identifiers.
The with syntax for import attributes is not yet supported.
rollup 364 changes
Breaking changes 34
Assets are deduplicated with previously emitted assets only when their source is a string.
Configuration files are bundled only when this option or
--bundleConfigAsCjsis used; otherwise Node's native mechanisms load them.Functions no longer receive rendered module information through
modules; they receive a list of includedmoduleIds.Module-referencing properties such as
idandidsnow contain full ids; only error messages use shortened ids.Plugins should use
this.getModuleInfo(...).moduleSideEffectsinstead.Emitted assets no longer have this flag in the bundle.
This helper now has a named export of the same name instead of a default export.
Its default is now
ifRelativeSource, so absolute external imports stay absolute while relative external imports are renormalized.Rollup now requires Node 14.18.0 or later to run.
Hooks defined in output plugins now run after hooks defined in input plugins.
Functions supplied for these output options are now called per chunk with chunk information.
The default is now
if-default-prop, which only adds__esModulewhen the default export would be a property.The default no longer quotes properties such as
default.The values
trueandfalseare no longer accepted; usecompatas a replacement fortrue.The default is now
defaultto better align with NodeJS interop.The default is now
true, requiring at least SystemJS 6.3.3.The order of plugin hooks during output generation has changed.
Its default is now
exports-only, so empty facades for entry chunks are no longer created by default.The
[ext],[extName], and[assetExtName]placeholders are no longer supported when preserving modules.When preserving modules,
[name]andchunkInfo.namenow include the relative chunk path and may include its extension.Chunk information now uses hash placeholders for names, replaced when used in returned code or chunk import/export information.
This plugin hook was removed; use
resolveFileUrlinstead.Rollup no longer passes the
assetReferenceIdparameter to this hook.Rollup no longer passes the
chunkReferenceIdparameter to this hook.The browser build is now available as a separate package.
Files in this path can only be required using their file extension.
This plugin context function was removed; use
this.emitFile()instead.This plugin context function was removed; use
this.emitFile()instead.This plugin context function was removed; use
this.getFileName()instead.This plugin context function was removed; use
this.getFileName()instead.This plugin context function was removed; use
this.resolve()instead.This plugin context function was removed; use
this.resolve()instead.This option was removed; use
treeshake.moduleSideEffects: 'no-external'instead.Rollup no longer adds
type: "asset"when assets are added directly to the bundle.
Deprecations 7
The input option is deprecated; use
output.inlineDynamicImportsinstead.The input option is deprecated; use
output.manualChunksinstead.This option is deprecated; use
maxParallelFileOpsinstead.This option is deprecated; use the
renderDynamicImportplugin hook instead.This option is deprecated; use
output.generatedCode.symbolsinstead.This option is deprecated; use
output.generatedCode.constBindingsinstead.The input option is deprecated; use
output.preserveModulesinstead.
New APIs and options 8
This option forces configuration files to be bundled to CommonJS.
The length of generated file hashes can now be customized globally and per chunk.
Plugins can add, remove, or change import assertions when resolving ids.
This option controls whether dynamic imports in CommonJS output remain
import(…)or are wrapped asrequire(…); by default they remain imports.This value adds an
__esModulemarker only if a default export is rendered as a property.This option turns off emission of import assertions.
The new
compatvalue is similar toautobut uses duck-typing to determine whether there is a default export.Plugins can access the entire chunk graph through an additional parameter.
Performance 1
Performance issues when emitting thousands of assets are avoided.
Behavior and default changes 12
Errors thrown in response to other errors use the standardized
causeproperty to reference the original error.Hashes now depend only on chunk content and remain stable against renamed or moved source files and changed module resolution order.
Assertions on external imports present in input files are retained in ESM output, and conflicting assertions trigger a warning.
This placeholder is now supported when preserving modules.
The option no longer times asynchronous plugin-hook work and adapts timings to the new hashing algorithm.
The option now collects synchronous timings for all plugin hooks rather than only a small selection.
Plugins modifying imports or exports in this hook should update
ChunkInfo.imports/importedBindings/exportsaccordingly.All errors thrown by Rollup now have
name: RollupError, identifying them as custom error types.Rollup waits for a Promise returned by an event handler attached to a watcher instance to resolve.
With the API and sourcemaps, comments are included in emitted files and sourcemaps are emitted as regular assets.
Rollup can statically resolve checks for
foo[Symbol.toStringTag]to"Module"whenfoois a namespace.Watch mode uses a custom event implementation that awaits Promises returned from event handlers.
Tooling 1
The node build now uses the
node:prefix for imports of builtin modules.
Fixes and other changes 1
Rollup no longer warns about implicitly using default export mode.
rollup 236 changes
Breaking changes 15
Plugins can only be used if they accept a passed-in Acorn instance instead of importing Acorn themselves.
TypeScript AST node types are now very generic and no longer use ESTree types or contain information specific to certain node types.
This option has been removed.
Modules that are completely tree-shaken are no longer listed as part of any chunks in this hook.
Rollup now requires at least Node 10 to run, or a sufficiently modern browser.
This plugin hook has been removed; use generateBundle instead.
This plugin hook has been removed; use writeBundle instead.
The ESM browser build moved here from rollup/dist/rollup.browser.es.js.
The main ESM entry point moved here from rollup/dist/rollup.es.js.
The plugin context no longer exposes this property.
The transform hook can no longer return dependencies.
This plugin hook has been removed; use renderChunk instead.
This plugin hook has been removed; use renderChunk instead.
This option accepts only an object of parameters passed to Rollup's bundled Chokidar instance; boolean values and user-installed Chokidar are no longer supported.
The hook now receives output options as its first parameter and the bundle object as its second, matching generateBundle.
Deprecations 12
Accessing this bundle property is deprecated; use chunk.type === 'asset' instead.
Directly adding properties to the bundle object in this hook is deprecated and warns; use this.emitFile. Removing properties remains allowed.
Using this in code now shows a warning; use import.meta.ROLLUP_FILE_URL_<..> instead.
Using this hook now shows a deprecation warning; use resolveFileUrl instead.
Using this plugin context function now shows a warning; use this.emitFile instead.
Using this plugin context function now shows a warning; use this.emitFile instead.
Using this plugin context function now shows a warning; use this.getFileName instead.
Using this plugin context function now shows a warning; use this.getFileName instead.
Using this plugin context function now shows a warning; use this.resolve instead.
Using this plugin context function now shows a warning; use this.resolve instead.
Use this option with 'no-external' instead of the deprecated treeshake.pureExternalModules option.
Using this option now shows a deprecation warning; use treeshake.moduleSideEffects: 'no-external' instead.
New APIs and options 3
Rollup can now be imported as an ES module in Node using conditional package exports; this is experimental.
Use this in place of the deprecated ROLLUP_ASSET_URL and ROLLUP_CHUNK_URL import.meta properties.
systemjs can now be used as a format alias for system.
Behavior and default changes 5
The error code for a missing name property when targeting UMD has changed to this code.
Rollup no longer introduces Node types into TypeScript projects that do not use them.
Empty imports from side-effect-free modules are not considered for chunking, side-effect imports are hoisted if necessary, and code-splitting produces better chunks.
Emitted chunks now have the TypeScript type UInt8Array instead of Buffer; Buffer can still be used.
Unknown output options now trigger a warning when using the JavaScript API.
Fixes and other changes 1
Sourcemaps are now generated correctly when tree-shaking occurs in a multi-file bundle.