rollup-plugin-compat
raw JSON → 0.22.4 verified Mon Apr 27 auth: no javascript
A Rollup plugin that transpiles bundled JavaScript output to an older ECMAScript standard (COMPAT) for legacy browser support. Version 0.22.4 is the latest stable release, but the package appears to be in early development with no README and no clear release cadence. Unlike full-featured transpilers like Babel or SWC, this plugin focuses narrowly on output compatibility, potentially offering faster builds for simple transpilation needs. Its key differentiator is being a Rollup-native solution, avoiding extra tooling configuration, though its capabilities and maintenance are uncertain due to lack of documentation. Recommended for experimental use only.
Common errors
error Error: Cannot find module 'rollup-plugin-compat' ↓
cause Package not installed or not in node_modules.
fix
Run
npm install rollup-plugin-compat --save-dev error TypeError: compat is not a function ↓
cause Incorrect import style; package may export differently.
fix
Use
import { compat } from 'rollup-plugin-compat' or check exports error Error: Unknown plugin 'compat' ↓
cause Plugin is not included in rollup.config.js or is not a function.
fix
Ensure
compat() is called (not just reference) in plugins array Warnings
gotcha The package lacks a README and comprehensive documentation; behavior is uncertain. ↓
fix Review source code or test extensively before using in production.
gotcha Version 0.22.4 is likely pre-1.0; API may break in minor/patch releases. ↓
fix Pin to exact version and expect breaking changes on update.
gotcha No release cadence established; package may be abandoned. ↓
fix Consider alternatives like @rollup/plugin-babel for production.
Install
npm install rollup-plugin-compat yarn add rollup-plugin-compat pnpm add rollup-plugin-compat Imports
- compat wrong
const compat = require('rollup-plugin-compat')correctimport compat from 'rollup-plugin-compat' - compat wrong
import compat from 'rollup-plugin-compat'correctimport { compat } from 'rollup-plugin-compat' - compat wrong
const compat = require('rollup-plugin-compat')correctconst { compat } = require('rollup-plugin-compat')
Quickstart
import { rollup } from 'rollup';
import compat from 'rollup-plugin-compat';
async function build() {
const bundle = await rollup({
input: 'src/index.js',
plugins: [compat()]
});
await bundle.write({ file: 'dist/bundle.js', format: 'iife' });
}
build().catch(console.error);