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

> rollup-plugin-terser@7.0.2 ships CommonJS and ESM builds. Dual package — require() works on every Node.js version we test; import works too.

Rollup plugin to minify generated es bundle

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

rollup-plugin-terser publishes both a CommonJS entry and a native ESM entry (ESM added in 6.1.0). require("rollup-plugin-terser") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. import "rollup-plugin-terser" works alongside it.

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

## What to do

1. Nothing to change. require("rollup-plugin-terser") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. import * as rollupPluginTerser from "rollup-plugin-terser" works alongside it; use named imports for what the ESM entry exports.
2. TypeScript: types are bundled; install nothing extra.
3. This package is deprecated: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-terser

## Facts

- 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

## Runtime test results for rollup-plugin-terser@7.0.2

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.

| Runtime | require("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.0 | works | works |

## How to import rollup-plugin-terser

ES modules:

```js
import * as rollupPluginTerser from "rollup-plugin-terser";
```

Namespace import shown because the ESM entry may have no default export; use named imports for what it exports.

CommonJS:

```js
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).

| Versions | Format | First published |
|---|---|---|
| 6.1.0 – 7.0.2 | Dual (CommonJS + ESM) | May 24, 2020 |
| 1.0.0 – 6.0.1 | CommonJS | May 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") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. import "rollup-plugin-terser" works alongside it.

**Can I require rollup-plugin-terser?**

Yes. rollup-plugin-terser ships a CommonJS entry alongside the native ESM entry. require("rollup-plugin-terser") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun.

**Does rollup-plugin-terser work in Bun?**

Yes. import "rollup-plugin-terser" loaded successfully in Bun 1.4.0 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

- [rollup-plugin-terser on npm](https://www.npmjs.com/package/rollup-plugin-terser)
- [Source repository](https://github.com/TrySound/rollup-plugin-terser)
- [HTML version](https://canirequire.com/package/rollup-plugin-terser/)
- [JSON version](https://canirequire.com/package/rollup-plugin-terser.json)

---

For scripts and AI agents: any package is at https://canirequire.com/package/<name>/index.md (Markdown) or https://canirequire.com/package/<name>.json (JSON); the site index is https://canirequire.com/llms.txt. Fetch the URL directly; no search needed.
