canirequire › CommonJS › ethereum-waffle
Is ethereum-waffle ESM-only? Can you require() it?
Sweeter, faster and simpler than truffle.
Latest version 4.0.10, published Feb 15, 2023. JSON
CommonJS CommonJS — require() works on every Node.js version
ethereum-waffle ships CommonJS only. require("ethereum-waffle") works everywhere. 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.
Does ethereum-waffle@4.0.10 actually load? Runtime test results
Runtime probe pending for this version. The values below are what package.json declares; they are refreshed once the probe runs.
| Runtime | require("ethereum-waffle") | import "ethereum-waffle" |
|---|---|---|
| Node.js 18 | ✓ expected | ✓ expected |
| Node.js 20 | ✓ expected | ✓ expected |
| Node.js 22 | ✓ expected | ✓ expected |
| Node.js 24 | ✓ expected | ✓ expected |
| Node.js 26 | ✓ expected | ✓ expected |
| Bun 1.4 | pending | pending |
Install failed in our sandbox: PROBE_TIMEOUT The rows above show what package.json declares.
How to import ethereum-waffle
ES modules (import)
import ethereumWaffle from "ethereum-waffle";Named imports from a CommonJS package only work when Node.js can statically detect them. If a named import fails, use the default import and destructure.
CommonJS (require)
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") works everywhere. 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
Other commonjs packages
- debug 4.4.3CommonJS
- semver 7.8.5CommonJS
- ms 2.1.3CommonJS
- picomatch 4.0.7CommonJS
- ajv 8.20.0CommonJS
- source-map 0.8.0CommonJS
- react-is 19.2.8CommonJS
- readable-stream 4.7.0CommonJS
Similar popularity
- karma-sinon-chai 2.0.2CommonJS
- progress-bar-webpack-plugin 2.1.0CommonJS
- ember-cli-uglify 3.0.0CommonJS
- grunt-mocha-test 0.13.3CommonJS
- ember-try 4.0.0CommonJS
- rollup-plugin-livereload 2.0.5CommonJS
- ember-ajax 5.1.2CommonJS
- mocha-lcov-reporter 1.3.0CommonJS