Skip to content

Upgrading rollup 3 to 4

Breaking3.30.0 → 4.67.4Breaking19Security9Platform1Deprecated2New50Changed172Fixed231Other118

Fetching 237 releases from GitHub…233 / 237
BreakingUpgrade verdict

19 breaking changes and a platform requirement change and 8 security fixes.

  • TypeScript users must switch from RollupWarning to RollupLog.
  • Acorn plugins are no longer supported and the `acornInjectPlugins` option has been removed.
  • The `acorn` option has been removed.
  • `inlineDynamicImports`, `manualChunks` and `preserveModules` have been removed on input option level; use the corresponding output options.
Top 5 of 30 that need code or config changes

Node.js requirement changed in 4.0.0-20: >=14.18.0 → >=18.0.0.

Breaking19
The RollupWarning type has been removed in favor of the RollupLog type.
RollupWarningRollupLog
Acorn plugins are no longer supported and the acornInjectPlugins option has been removed.
acornInjectPlugins
The acorn option has been removed.
acorn
inlineDynamicImports, manualChunks and preserveModules have been removed on input option level; use the corresponding output options.
inlineDynamicImportsmanualChunkspreserveModules
Removes the output options output.experimentalDeepDynamicChunkOptimization, output.dynamicImportFunction, output.namespaceToStringTag and output.preferConst.
output.experimentalDeepDynamicChunkOptimizationoutput.dynamicImportFunctionoutput.namespaceToStringTagoutput.preferConstrenderDynamicImportoutput.generatedCode.symbolsoutput.generatedCode.constBindings
For this.resolve, the default of the skipSelf option is now true.
this.resolveskipSelf
If a module id import is handled by a plugin's load hook, rollup.watch no longer watches the actual file; plugins must call this.addWatchFile for dependencies.
loadrollup.watchthis.addWatchFile
Normalized input options from buildStart and other hooks no longer contain an onwarn handler; plugins should use onLog instead.
buildStartonwarnonLog
Removes this.moduleIds from the plugin context; use this.getModuleIds() instead.
this.moduleIdsthis.getModuleIds()
Removes the hasModuleSideEffects flag from ModuleInfo; use moduleSideEffects on ModuleInfo instead.
hasModuleSideEffectsModuleInfothis.getModuleInfo()moduleSideEffects
The browser build now relies on a WASM artifact that needs to be provided as well.
The NodeJS build now relies on an optional native binary; unsupported platforms can use the @rollup/wasm-node package with the same interface.
@rollup/wasm-node
The "with" syntax for import attributes is not yet supported, awaiting support in SWC.
The INVALID_IMPORT_ASSERTION error code has been replaced with INVALID_IMPORT_ATTRIBUTE.
INVALID_IMPORT_ASSERTIONINVALID_IMPORT_ATTRIBUTE
File hashes now use url-safe base64 encoded hashes.
The maximum hash length has been reduced to 22 characters.
this.parse now only supports the allowReturnOutsideFunction option for now.
this.parseallowReturnOutsideFunction
Import assertions now use the new import attribute AST structure.
"assertions" have been replaced with "attributes" in various places of the plugin interface.
Security8
Eliminates AWS credential exposure on fork PRs in the REPL artefact workflow.
Resolves vulnerabilities.
Rollup 4 has Arbitrary File Write via Path Traversal
High
Updates the vite dependency to v7.1.11 for a security fix.
vite
Updates eslint-plugin-unicorn to resolve a vulnerability.
eslint-plugin-unicorn
Fixes a DOM Clobbering CVE in generated bundles.
DOM Clobbering Gadget found in rollup bundled scripts that leads to XSS
High · CVSS 6.4
Updates the vite dependency to v5.0.12 for a security fix.
vite
Platform1
The minimal required Node version is now 18.0.0.
Deprecated2
Deprecates returning import attributes from load or transform hooks, which will not be supported in rollup 5.
loadtransform
output.externalImportAssertions is deprecated in favor of output.externalImportAttributes.
output.externalImportAssertionsoutput.externalImportAttributes