Packages

@rollup/plugin-commonjs

29.0.3 · 29 May 2026MIT20.8M / weekRepositoryHomepagenpmAtom feed

Your version

22.0.0

major24 Apr 2022Where it was published

22.0.2 is the newest release of 22.x.

In short

2 breaking9 new10 fixed1 internal

  • breaking

    Add heuristic to deoptimize requires after calling imported function (requires rollup@2.68.0)

  • breaking

    Reimplement dynamic import handling (requires Node 12, no longer supports require.cache)

Release note

The section about @rollup/plugin-commonjs of a note shared by several packages.

2022-04-24

Breaking Changes

  • breaking

    Add heuristic to deoptimize requires after calling imported function (requires rollup@2.68.0)

  • breaking

    Reimplement dynamic import handling (requires Node 12, no longer supports require.cache)

Bugfixes

  • Support CJS modules re-exporting transpiled ESM modules

  • Warn when plugins do not pass options to resolveId

  • Do not change semantics when removing requires in if statements

  • Handle external dependencies when using the cache

  • Proxy all entries to not break legacy polyfill plugins

  • Use correct version and add package exports

  • Validate node-resolve peer version

  • Inject module name into dynamic require function

  • Do not transform "typeof exports" for mixed modules

  • Attach correct plugin meta-data to commonjs modules

Features

  • Expose plugin version

  • Throw for dynamic requires from outside the configured root

  • Add dynamicRequireRoot option

  • auto-detect conditional requires

  • Limit ignoreTryCatch to external requires

  • Make namespace callable when requiring ESM with function default

  • Infer type for unidentified modules

  • Automatically wrap cyclic modules

  • Add strictRequires option to wrap modules