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. JSON
Dual (CommonJS + ESM) Dual package — both require() and import work
react-hook-form publishes both a CommonJS entry and a native ESM entry (ESM added in 6.9.6). require("react-hook-form") and import "react-hook-form" both work on every supported Node.js version and in Bun.
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 | ✓ works | ✓ works |
How to import react-hook-form
ES modules (import)
import reactHookForm from "react-hook-form";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 (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") and import "react-hook-form" both work on every supported Node.js version and in Bun.
Can I require react-hook-form?
Yes. react-hook-form ships a CommonJS entry, so require("react-hook-form") works on every Node.js version, alongside the native ESM entry for import.
Does react-hook-form work in Bun?
Yes. import "react-hook-form" loaded successfully in Bun 1.4 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
- glob 13.0.6Dual
- eslint-visitor-keys 5.0.1Dual
- yallist 5.0.0Dual
- balanced-match 4.0.4Dual
- js-yaml 5.4.1Dual
Similar popularity
- smart-buffer 4.2.0CommonJS
- ecdsa-sig-formatter 1.0.11CommonJS
- graphemer 1.4.0CommonJS
- concat-stream 2.0.0CommonJS
- @babel/preset-env 8.0.2ESM-only
- set-proto 1.0.0CommonJS
- postcss-import 17.0.0CommonJS
- @radix-ui/react-tooltip 1.2.16Dual