A Rollup plugin that automatically verifies CommonJS output compatibility with Node.js's cjs-module-lexer. Currently at v1.0.3, with stable release cadence. It analyzes the generated CJS bundle and compares the exports detected by Rollup against those that cjs-module-lexer would detect, flagging mismatches that cause broken named imports in Node.js ESM. Unlike manual testing, this provides automated CI enforcement. Requires Rollup >=1.20.0 and Node >=14.0.0.
npm install rollup-plugin-cjs-checkVerified import paths — ran on the pinned version, not inferred.
Basic Rollup configuration using the cjs-check plugin to validate CJS exports.
Ensure your Rollup output format is 'cjs'.
Review the reported mismatches and adjust named exports or use 'output.exports: 'named'' configuration.
Use static export syntax or output format 'es' for full ESM compatibility.
Ensure the Rollup configuration uses format: 'cjs'.