canirequire › Dual (CommonJS + ESM) › @rollup/plugin-image
Is @rollup/plugin-image ESM-only? Can you require() it?
Import JPG, PNG, GIF, SVG, and WebP files
Last verified Sep 9, 2026 against @rollup/plugin-image@3.0.3. JSON
Dual (CommonJS + ESM) Dual package — both require() and import work
@rollup/plugin-image publishes both a CommonJS entry and a native ESM entry (ESM added in 3.0.0). require("@rollup/plugin-image") and import "@rollup/plugin-image" both work on every supported Node.js version and in Bun.
Does @rollup/plugin-image@3.0.3 actually load? Runtime test results
Installed and executed on Sep 9, 2026 with require("@rollup/plugin-image") from a CommonJS file and import "@rollup/plugin-image" from an ES module.
| Runtime | require("@rollup/plugin-image") | import "@rollup/plugin-image" |
|---|---|---|
| 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-image
ES modules (import)
import pluginImage from "@rollup/plugin-image";CommonJS (require)
const pluginImage = require("@rollup/plugin-image");Module format by version
Derived from the type, main and exports fields of every stable release on npm (12 versions; the newest 12 shown).
| Versions | Format | First published |
|---|---|---|
| 3.0.0 – 3.0.3 | Dual (CommonJS + ESM) | Oct 9, 2022 |
| 2.0.0 – 2.1.1 | CommonJS | Nov 20, 2019 |
Frequently asked
Is @rollup/plugin-image ESM-only?
@rollup/plugin-image@3.0.3 ships CommonJS and ESM builds. @rollup/plugin-image publishes both a CommonJS entry and a native ESM entry (ESM added in 3.0.0). require("@rollup/plugin-image") and import "@rollup/plugin-image" both work on every supported Node.js version and in Bun.
Can I require @rollup/plugin-image?
Yes. @rollup/plugin-image ships a CommonJS entry, so require("@rollup/plugin-image") works on every Node.js version, alongside the native ESM entry for import.
Does @rollup/plugin-image work in Bun?
Yes. import "@rollup/plugin-image" loaded successfully in Bun 1.4 on Sep 9, 2026.
Does @rollup/plugin-image ship TypeScript types?
Yes. @rollup/plugin-image bundles its own type declarations; no @types package is needed.
Links
Other dual (commonjs + esm) packages
- minimatch 10.2.6Dual
- brace-expansion 5.0.9Dual
- lru-cache 11.5.2Dual
- glob 13.0.6Dual
- eslint-visitor-keys 5.0.1Dual
- yallist 5.0.0Dual
- balanced-match 4.0.4Dual
- js-yaml 5.4.1Dual
Similar popularity
- @oclif/config 1.18.17CommonJS
- @semantic-release/git 11.0.1ESM-only
- @vue/eslint-config-typescript 14.9.0Dual
- @fortawesome/fontawesome-free 7.3.1CommonJS
- @ethersproject/solidity 5.8.0CommonJS
- @semantic-release/changelog 7.0.0ESM-only
- @material-ui/core 4.12.4CommonJS
- @storybook/testing-library 0.2.2CommonJS