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.
In plain terms
- 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.
Must act 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.
What you must change
Breaking19
The
RollupWarning type has been removed in favor of the RollupLog type.RollupWarningRollupLogAcorn plugins are no longer supported and the
acornInjectPlugins option has been removed.acornInjectPluginsThe
acorn option has been removed.acorninlineDynamicImports, manualChunks and preserveModules have been removed on input option level; use the corresponding output options.inlineDynamicImportsmanualChunkspreserveModulesRemoves the output options
output.experimentalDeepDynamicChunkOptimization, output.dynamicImportFunction, output.namespaceToStringTag and output.preferConst.output.experimentalDeepDynamicChunkOptimizationoutput.dynamicImportFunctionoutput.namespaceToStringTagoutput.preferConstrenderDynamicImportoutput.generatedCode.symbolsoutput.generatedCode.constBindingsFor
this.resolve, the default of the skipSelf option is now true.this.resolveskipSelfIf 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.addWatchFileNormalized input options from buildStart and other hooks no longer contain an onwarn handler; plugins should use onLog instead.
buildStartonwarnonLogRemoves 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()moduleSideEffectsThe 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-nodeThe "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_ATTRIBUTEFile 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.parseallowReturnOutsideFunctionImport 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
HighUpdates the vite dependency to v7.1.11 for a security fix.
viteUpdates eslint-plugin-unicorn to resolve a vulnerability.
eslint-plugin-unicornFixes a DOM Clobbering CVE in generated bundles.
DOM Clobbering Gadget found in rollup bundled scripts that leads to XSS
High · CVSS 6.4Updates the vite dependency to v5.0.12 for a security fix.
vitePlatform1
The minimal required Node version is now 18.0.0.
Deprecations to plan for
Deprecated2
Deprecates returning import attributes from
load or transform hooks, which will not be supported in rollup 5.loadtransformoutput.externalImportAssertions is deprecated in favor of output.externalImportAttributes.output.externalImportAssertionsoutput.externalImportAttributes