# Is @vitest/coverage-c8 ESM-only? Can you require() it?

> @vitest/coverage-c8@0.33.0 is ESM-only. ESM-only — it has never shipped a CommonJS build.

C8 coverage provider for Vitest

Last verified Sep 9, 2026 against @vitest/coverage-c8@0.33.0.

@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.

**Deprecated:** v8 coverage is moved to @vitest/coverage-v8 package

## 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

## Facts

- 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

## Runtime test results for @vitest/coverage-c8@0.33.0

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 | fails (ERR_PACKAGE_PATH_NOT_EXPORTED) | works |
| Node.js 20 | fails (ERR_PACKAGE_PATH_NOT_EXPORTED) | works |
| Node.js 22 | fails (ERR_PACKAGE_PATH_NOT_EXPORTED) | works |
| Node.js 24 | fails (ERR_PACKAGE_PATH_NOT_EXPORTED) | works |
| Node.js 26 | fails (ERR_PACKAGE_PATH_NOT_EXPORTED) | works |
| Bun 1.4.0 | fails (Error) | works |

## How to import @vitest/coverage-c8

ES modules:

```js
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:

```js
// 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 (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

- [@vitest/coverage-c8 on npm](https://www.npmjs.com/package/@vitest/coverage-c8)
- [Source repository](https://github.com/vitest-dev/vitest)
- [HTML version](https://canirequire.com/package/@vitest/coverage-c8/)
- [JSON version](https://canirequire.com/package/@vitest/coverage-c8.json)

---

For scripts and AI agents: any package is at https://canirequire.com/package/<name>/index.md (Markdown) or https://canirequire.com/package/<name>.json (JSON); the site index is https://canirequire.com/llms.txt. Fetch the URL directly; no search needed.
