canirequire

canirequire › Dual (CommonJS + ESM) › colorette

Is colorette ESM-only? Can you require() it?

🌈Easily set your terminal text color & styles.

Last verified Sep 9, 2026 against colorette@2.0.20. JSON

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

colorette publishes both a CommonJS entry and a native ESM entry (ESM added in 1.2.1). require("colorette") and import "colorette" both work on every supported Node.js version and in Bun.

Latest
2.0.20 (Apr 16, 2023)
Module format
Dual (CommonJS + ESM)
Last CommonJS version
2.0.20
Native ESM since
1.2.1
TypeScript types
Bundled
Node engines
not declared
Weekly downloads
52.9M
License
MIT

Does colorette@2.0.20 actually load? Runtime test results

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

Runtimerequire("colorette")import "colorette"
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 colorette

ES modules (import)

import colorette from "colorette";

CommonJS (require)

const colorette = require("colorette");

Module format by version

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

VersionsFormatFirst published
1.2.1 – 2.0.20Dual (CommonJS + ESM)Jul 5, 2020
0.1.0 – 1.2.0CommonJSAug 23, 2018

Frequently asked

Is colorette ESM-only?

colorette@2.0.20 ships CommonJS and ESM builds. colorette publishes both a CommonJS entry and a native ESM entry (ESM added in 1.2.1). require("colorette") and import "colorette" both work on every supported Node.js version and in Bun.

Can I require colorette?

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

Does colorette work in Bun?

Yes. import "colorette" loaded successfully in Bun 1.4 on Sep 9, 2026.

Does colorette ship TypeScript types?

Yes. colorette bundles its own type declarations; no @types package is needed.

Links

Other dual (commonjs + esm) packages

Similar popularity