canirequire › Dual (CommonJS + ESM) › react-hook-form
Is react-hook-form ESM-only? Can you require() it?
Performant, flexible and extensible forms library for React Hooks
Last verified Sep 9, 2026 against react-hook-form@7.87.0. Markdown · JSON
Dual (CommonJS + ESM) Dual package — require() works on every Node.js version we test; import works too
react-hook-form publishes both a CommonJS entry and a native ESM entry (ESM added in 6.9.6). require("react-hook-form") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. The package declares Node.js >=18.0.0. import "react-hook-form" works alongside it.
What to do
- Nothing to change. require("react-hook-form") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. The package declares Node.js >=18.0.0. import * as reactHookForm from "react-hook-form" works alongside it; use named imports for what the ESM entry exports.
- TypeScript: types are bundled; install nothing extra.
Does react-hook-form@7.87.0 actually load? Runtime test results
Installed and executed on Sep 9, 2026 with require("react-hook-form") from a CommonJS file and import "react-hook-form" from an ES module.
| Runtime | require("react-hook-form") | import "react-hook-form" |
|---|---|---|
| Node.js 18 | ✓ works | ✓ works |
| Node.js 20 | ✓ works | ✓ works |
| Node.js 22 | ✓ works | ✓ works |
| Node.js 24 | ✓ works | ✓ works |
| Node.js 26 | ✓ works | ✓ works |
| Bun 1.4.0 | ✓ works | ✓ works |
How to import react-hook-form
ES modules (import)
import * as reactHookForm from "react-hook-form";Namespace import shown because the ESM entry may have no default export; use named imports for what it exports.
CommonJS (require)
const reactHookForm = require("react-hook-form");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 (590 versions; the newest 60 shown).
| Versions | Format | First published |
|---|---|---|
| 7.50.1 – 7.87.0 | Dual (CommonJS + ESM) | Feb 6, 2024 |
Frequently asked
Is react-hook-form ESM-only?
react-hook-form@7.87.0 ships CommonJS and ESM builds. react-hook-form publishes both a CommonJS entry and a native ESM entry (ESM added in 6.9.6). require("react-hook-form") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. The package declares Node.js >=18.0.0. import "react-hook-form" works alongside it.
Can I require react-hook-form?
Yes. react-hook-form ships a CommonJS entry alongside the native ESM entry. require("react-hook-form") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. The package declares Node.js >=18.0.0.
Does react-hook-form work in Bun?
Yes. import "react-hook-form" loaded successfully in Bun 1.4.0 on Sep 9, 2026.
Does react-hook-form ship TypeScript types?
Yes. react-hook-form bundles its own type declarations; no @types package is needed.
Links
Other dual (commonjs + esm) packages
- minimatch 10.2.6Dual
- brace-expansion 5.0.9Dual
- lru-cache 11.5.2Dual
- tslib 2.8.1Dual
- glob 13.0.6Dual
- eslint-visitor-keys 5.0.1Dual
- yallist 5.0.0Dual
- balanced-match 4.0.4Dual
Similar popularity
- graphemer 1.4.0CommonJS
- @csstools/color-helpers 6.1.1ESM-only
- concat-stream 2.0.0CommonJS
- @jest/expect-utils 30.5.1Dual
- @babel/preset-env 8.0.2ESM-only
- set-proto 1.0.0CommonJS
- postcss-import 17.0.0CommonJS
- @radix-ui/react-tooltip 1.2.16Dual