# Is ethereum-waffle ESM-only? Can you require() it?

> ethereum-waffle@4.0.10 is a CommonJS package. CommonJS — require() works on every Node.js version we test.

Sweeter, faster and simpler than truffle.

Latest version 4.0.10, published Feb 15, 2023.

ethereum-waffle ships CommonJS only. require("ethereum-waffle") should work on every Node.js version the package supports (>=10.0); the runtime probe has not run for this version. import "ethereum-waffle" also works because Node.js and Bun can import CommonJS from ES modules, but only the default export is guaranteed; named imports depend on Node's static analysis of the module.

It also declares a "module" field, so bundlers such as webpack, Vite and esbuild pick up an ESM build for tree-shaking.

## What to do

1. require("ethereum-waffle") should work on every Node.js version the package supports (>=10.0); the runtime probe has not run for this version.
2. From ES modules use the default import: import ethereumWaffle from "ethereum-waffle"; then destructure. Named imports only work when Node.js can statically detect the exports.
3. TypeScript: types are bundled; install nothing extra.

## Facts

- Latest: 4.0.10 (Feb 15, 2023)
- Module format: CommonJS
- Last CommonJS version: 4.0.10
- TypeScript types: bundled
- Node engines: >=10.0
- Weekly downloads: 56K
- License: MIT

## Runtime test results for ethereum-waffle@4.0.10

Runtime probe pending for this version (install failed: PROBE_TIMEOUT). The facts above come from package.json.

## How to import ethereum-waffle

ES modules:

```js
import ethereumWaffle from "ethereum-waffle";
```

CommonJS:

```js
const ethereumWaffle = require("ethereum-waffle");
```

## Module format by version

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

| Versions | Format | First published |
|---|---|---|
| 1.0.3 – 4.0.10 | CommonJS | Nov 27, 2018 |

## Frequently asked

**Is ethereum-waffle ESM-only?**

ethereum-waffle@4.0.10 is a CommonJS package. ethereum-waffle ships CommonJS only. require("ethereum-waffle") should work on every Node.js version the package supports (>=10.0); the runtime probe has not run for this version. import "ethereum-waffle" also works because Node.js and Bun can import CommonJS from ES modules, but only the default export is guaranteed; named imports depend on Node's static analysis of the module.

**Can I import ethereum-waffle with ES module syntax?**

Yes. import ethereumWaffle from "ethereum-waffle" works in Node.js and Bun because they support importing CommonJS modules. Named imports work only when Node.js can statically detect the exports.

**Does ethereum-waffle ship TypeScript types?**

Yes. ethereum-waffle bundles its own type declarations; no @types package is needed.

## Links

- [ethereum-waffle on npm](https://www.npmjs.com/package/ethereum-waffle)
- [Source repository](https://github.com/EthWorks/Waffle)
- [HTML version](https://canirequire.com/package/ethereum-waffle/)
- [JSON version](https://canirequire.com/package/ethereum-waffle.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.
