canirequire › ESM-only › @vitest/coverage-c8
Is @vitest/coverage-c8 ESM-only? Can you require() it?
C8 coverage provider for Vitest
Last verified Sep 9, 2026 against @vitest/coverage-c8@0.33.0. Markdown · JSON
ESM-only ESM-only — it has never shipped a CommonJS build
@vitest/coverage-c8 has been ESM-only since its first stable release; there is no CommonJS version to pin.
require("@vitest/coverage-c8") failed in our probe on Node.js 20+ as well; see the runtime table for the error before relying on it. On Node.js 18, which has no require(esm), require("@vitest/coverage-c8") fails with ERR_REQUIRE_ESM.
What to do
- require("@vitest/coverage-c8") failed in our probe on Node.js 20+ as well; see the runtime table for the error before relying on it.
- From a CommonJS file, use a dynamic import inside an async function: const coverageC8 = await import("@vitest/coverage-c8"). That works on every Node.js version the package supports.
- There is no CommonJS release of @vitest/coverage-c8 to pin; without require(esm) the only option is a dynamic import().
- TypeScript: types are bundled; install nothing extra.
- This package is deprecated: v8 coverage is moved to @vitest/coverage-v8 package
Deprecated: v8 coverage is moved to @vitest/coverage-v8 package
Does @vitest/coverage-c8@0.33.0 actually load? Runtime test results
Installed and executed on Sep 9, 2026 with require("@vitest/coverage-c8") from a CommonJS file and import "@vitest/coverage-c8" from an ES module.
| Runtime | require("@vitest/coverage-c8") | import "@vitest/coverage-c8" |
|---|---|---|
| Node.js 18 | ✗ failsERR_PACKAGE_PATH_NOT_EXPORTED | ✓ works |
| Node.js 20 | ✗ failsERR_PACKAGE_PATH_NOT_EXPORTED | ✓ works |
| Node.js 22 | ✗ failsERR_PACKAGE_PATH_NOT_EXPORTED | ✓ works |
| Node.js 24 | ✗ failsERR_PACKAGE_PATH_NOT_EXPORTED | ✓ works |
| Node.js 26 | ✗ failsERR_PACKAGE_PATH_NOT_EXPORTED | ✓ works |
| Bun 1.4.0 | ✗ failsError | ✓ works |
How to import @vitest/coverage-c8
ES modules (import)
import * as coverageC8 from "@vitest/coverage-c8";Namespace import shown because the ESM entry may have no default export; use named imports for what it exports.
CommonJS (require)
// require("@vitest/coverage-c8") failed in our probe on Node.js 20.19+, 22.12+ and newer as well (ERR_PACKAGE_PATH_NOT_EXPORTED); see the runtime table.
// Any Node.js version the package supports, from an async function:
async function main() {
const coverageC8 = await import("@vitest/coverage-c8");
}Module format by version
Derived from the type, main and exports fields of every stable release on npm, corrected where a runtime test of that version contradicted them (56 versions; the newest 56 shown).
| Versions | Format | First published |
|---|---|---|
| 0.22.0 – 0.33.0 | ESM-only | Aug 15, 2022 |
Frequently asked
Is @vitest/coverage-c8 ESM-only?
@vitest/coverage-c8@0.33.0 is ESM-only. @vitest/coverage-c8 has been ESM-only since its first stable release; there is no CommonJS version to pin.
Which version of @vitest/coverage-c8 still supports CommonJS / require()?
None. @vitest/coverage-c8 has always been ESM-only. Use import, or a dynamic import("@vitest/coverage-c8") from an async function in CommonJS.
How do I use @vitest/coverage-c8 from a CommonJS file?
From a CommonJS file, use a dynamic import inside an async function: const coverageC8 = await import("@vitest/coverage-c8"). That works on every Node.js version the package supports. require("@vitest/coverage-c8") failed in our probe on Node.js 20+ as well; see the runtime table for the error before relying on it.
Does @vitest/coverage-c8 work in Bun?
Yes. import "@vitest/coverage-c8" loaded successfully in Bun 1.4.0 on Sep 9, 2026.
Does @vitest/coverage-c8 ship TypeScript types?
Yes. @vitest/coverage-c8 bundles its own type declarations; no @types package is needed.
Links
Other esm-only packages
- ansi-styles 7.0.0last CJS
5.2.0 - strip-ansi 7.2.0last CJS
6.0.1 - commander 15.0.0last CJS
14.0.3 - supports-color 11.0.0last CJS
8.1.1 - chalk 6.0.0last CJS
4.1.2 - string-width 8.2.2last CJS
4.2.3 - ansi-regex 6.3.0last CJS
5.0.1 - escape-string-regexp 5.0.0last CJS
4.0.0
Similar popularity
- @vue/eslint-config-standard 9.0.1ESM-only
- rollup-plugin-delete 3.0.2ESM-only
- @nomiclabs/hardhat-ethers 2.2.3CommonJS
- babel-plugin-transform-vue-jsx 3.7.0CommonJS
- run-sequence 2.2.1CommonJS
- rollup-plugin-uglify 6.0.4CommonJS
- phantomjs 2.1.7CommonJS
- karma-chai 0.1.0CommonJS