canirequire

canirequireDual (CommonJS + ESM) › rollup-plugin-terser

Is rollup-plugin-terser ESM-only? Can you require() it?

Rollup plugin to minify generated es bundle

Last verified Sep 9, 2026 against rollup-plugin-terser@7.0.2. JSON

Dual (CommonJS + ESM) Dual package — both require() and import work

rollup-plugin-terser publishes both a CommonJS entry and a native ESM entry (ESM added in 6.1.0). require("rollup-plugin-terser") and import "rollup-plugin-terser" both work on every supported Node.js version and in Bun.

Latest
7.0.2 (Sep 4, 2020)
Module format
Dual (CommonJS + ESM)
Last CommonJS version
7.0.2
Native ESM since
6.1.0
TypeScript types
Bundled
Node engines
not declared
Weekly downloads
3.4M
License
MIT

Deprecated: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-terser

Does rollup-plugin-terser@7.0.2 actually load? Runtime test results

Installed and executed on Sep 9, 2026 with require("rollup-plugin-terser") from a CommonJS file and import "rollup-plugin-terser" from an ES module.

Runtimerequire("rollup-plugin-terser")import "rollup-plugin-terser"
Node.js 18✓ works✓ works
Node.js 20✓ works✓ works
Node.js 22✓ works✓ works
Node.js 24✓ works✓ works
Node.js 26✓ works✓ works
Bun 1.4✓ works✓ works

How to import rollup-plugin-terser

ES modules (import)

import rollupPluginTerser from "rollup-plugin-terser";

CommonJS (require)

const rollupPluginTerser = require("rollup-plugin-terser");

Module format by version

Derived from the type, main and exports fields of every stable release on npm (25 versions; the newest 25 shown).

VersionsFormatFirst published
6.1.0 – 7.0.2Dual (CommonJS + ESM)May 24, 2020
1.0.0 – 6.0.1CommonJSMay 17, 2018

Frequently asked

Is rollup-plugin-terser ESM-only?

rollup-plugin-terser@7.0.2 ships CommonJS and ESM builds. rollup-plugin-terser publishes both a CommonJS entry and a native ESM entry (ESM added in 6.1.0). require("rollup-plugin-terser") and import "rollup-plugin-terser" both work on every supported Node.js version and in Bun.

Can I require rollup-plugin-terser?

Yes. rollup-plugin-terser ships a CommonJS entry, so require("rollup-plugin-terser") works on every Node.js version, alongside the native ESM entry for import.

Does rollup-plugin-terser work in Bun?

Yes. import "rollup-plugin-terser" loaded successfully in Bun 1.4 on Sep 9, 2026.

Does rollup-plugin-terser ship TypeScript types?

Yes. rollup-plugin-terser bundles its own type declarations; no @types package is needed.

Links

Other dual (commonjs + esm) packages

Similar popularity