Check Node and plugin compatibility

Before upgrading Rollup, verify your runtime environment and plugin ecosystem. Rollup 4 drops support for older Node.js versions and relies on updated plugin APIs. Skipping this step often leads to cryptic build errors that are harder to debug than the migration itself.

Verify Node.js version

Rollup 4 requires Node.js 18.0.0 or higher. This is a hard requirement, not a recommendation. If you are running an older LTS version, upgrade Node before touching your package.json.

Shell
node -v

If the output is below v18.0.0, update your local environment and your CI/CD pipeline settings. Many build failures in Rollup 4 stem from missing modern JavaScript features that only exist in newer V8 engines.

Audit your plugins

Older plugins may not support Rollup 4's new internal API. Check your package.json dependencies and cross-reference them with the Rollup migration guide for known incompatibilities.

  • Common culprits: @rollup/plugin-commonjs, @rollup/plugin-node-resolve, and @rollup/plugin-typescript.
  • Action: Update these packages to their latest versions compatible with Rollup 4.
  • Note: If a plugin hasn't been updated, check its GitHub issues for community workarounds or consider switching to a maintained alternative.

Run npm ls @rollup/plugin-commonjs (and other plugins) to verify versions. If you see deprecated warnings, address them now. A clean dependency tree makes the actual upgrade process significantly smoother.

Update configuration syntax

Rollup 4 removes several legacy options and renames others to align with modern bundling standards. Your existing rollup.config.js will fail to parse if you don't update these specific syntax patterns. Focus on removing deprecated flags and correcting property names to ensure a clean build pipeline.

1
Remove legacy plugin configurations

Rollup 4 drops support for older plugin interfaces that relied on this.emitFile in non-standard ways or used deprecated output options. If you are using plugins like @rollup/plugin-commonjs or @rollup/plugin-node-resolve, ensure they are updated to their latest versions, as they handle the new syntax internally. Manually removing any custom legacy flags or deprecated output properties from your config is required.

2
Update output globals

The output.globals option is now strictly enforced for UMD and IIFE formats. Ensure every external dependency listed in external has a corresponding key in globals. Rollup 4 will throw an error if a global is missing or misnamed. This prevents runtime undefined errors in browser bundles.

3
Replace deprecated options

Several options have been renamed or removed. output.entryFileNames and output.chunkFileNames now use template strings exclusively. Remove any legacy format values like amd or cjs if you are migrating to modern standards like es or cjs with proper exports. Check the Rollup migration guide for a full list of removed flags.

Migrate plugin APIs

Migrating to Rollup 4 works best as a clear sequence: define the constraint, compare the realistic options, test the tradeoff, and choose the path with the fewest hidden costs. That order keeps the advice usable instead of decorative.

After each step, pause long enough to check whether the recommendation still fits the reader's actual situation. If it depends on perfect timing, unusual access, or a best-case budget, include a simpler fallback.

1
Define the constraint

Name the space, budget, timing, or skill limit that shapes the migration decision.

2
Compare realistic options

Use the same criteria for each option so the tradeoff is visible.

3
Choose the practical path

Pick the option that still works after cost, maintenance, and fallback needs are included.

Verify build output and tests

Migrating to Rollup 4 requires a clear sequence: define the constraint, compare the realistic options, test the tradeoff, and choose the path with the fewest hidden costs. That order keeps the advice usable instead of decorative.

After each step, pause long enough to check whether the recommendation still fits the reader's actual situation. If it depends on perfect timing, unusual access, or a best-case budget, include a simpler fallback.

The simplest way to use this section is to write down the real constraint first, compare each option against it, and choose the path that still works outside ideal conditions.

Rollup 4 vs Webpack for modern builds

Migrating to Rollup 4 often triggers specific concerns about compatibility and build output. The following answers address the most frequent questions developers encounter during this transition.