canirequire

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

  1. 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.
  2. 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.
  3. There is no CommonJS release of @vitest/coverage-c8 to pin; without require(esm) the only option is a dynamic import().
  4. TypeScript: types are bundled; install nothing extra.
  5. This package is deprecated: v8 coverage is moved to @vitest/coverage-v8 package
Latest
0.33.0 (Jul 6, 2023)
Module format
ESM-only
Last CommonJS version
none
ESM-only since
0.22.0 (Aug 15, 2022)
TypeScript types
Bundled
Node engines
not declared
Weekly downloads
98K
License
MIT

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.

Runtimerequire("@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).

VersionsFormatFirst published
0.22.0 – 0.33.0ESM-onlyAug 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

Similar popularity