canirequire

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

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

Rollup plugin for grabbing source maps from sourceMappingURLs

Last verified Sep 9, 2026 against rollup-plugin-sourcemaps@0.6.3. JSON

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

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

Latest
0.6.3 (Oct 7, 2020)
Module format
Dual (CommonJS + ESM)
Last CommonJS version
0.6.3
Native ESM since
0.6.0
TypeScript types
Bundled
Node engines
>=10.0.0
Weekly downloads
627K
License
MIT

Does rollup-plugin-sourcemaps@0.6.3 actually load? Runtime test results

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

Runtimerequire("rollup-plugin-sourcemaps")import "rollup-plugin-sourcemaps"
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-sourcemaps

ES modules (import)

import rollupPluginSourcemaps from "rollup-plugin-sourcemaps";

CommonJS (require)

const rollupPluginSourcemaps = require("rollup-plugin-sourcemaps");

Module format by version

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

VersionsFormatFirst published
0.6.0 – 0.6.3Dual (CommonJS + ESM)Apr 30, 2020
0.1.0 – 0.5.0CommonJSJun 19, 2016

Frequently asked

Is rollup-plugin-sourcemaps ESM-only?

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

Can I require rollup-plugin-sourcemaps?

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

Does rollup-plugin-sourcemaps work in Bun?

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

Does rollup-plugin-sourcemaps ship TypeScript types?

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

Links

Other dual (commonjs + esm) packages

Similar popularity