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.
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.
| Runtime | require("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).
| Versions | Format | First published |
|---|---|---|
| 1.2.1 – 2.0.20 | Dual (CommonJS + ESM) | Jul 5, 2020 |
| 0.1.0 – 1.2.0 | CommonJS | Aug 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
- 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
- fflate 0.8.3Dual
- web-streams-polyfill 4.3.0Dual
- import-in-the-middle 3.5.0CommonJS
- bignumber.js 11.1.5Dual
- jest-validate 30.5.1Dual
- isobject 4.1.1CommonJS
- proc-log 7.0.0CommonJS
- safe-stable-stringify 2.5.0Dual