canirequire › Dual (CommonJS + ESM) › @sinclair/typebox
Is @sinclair/typebox ESM-only? Can you require() it?
Json Schema Type Builder with Static Type Resolution for TypeScript
Last verified Sep 9, 2026 against @sinclair/typebox@0.34.52. JSON
Dual (CommonJS + ESM) Dual package — both require() and import work
@sinclair/typebox publishes both a CommonJS entry and a native ESM entry (ESM added in 0.32.0). require("@sinclair/typebox") and import "@sinclair/typebox" both work on every supported Node.js version and in Bun.
Does @sinclair/typebox@0.34.52 actually load? Runtime test results
Installed and executed on Sep 9, 2026 with require("@sinclair/typebox") from a CommonJS file and import "@sinclair/typebox" from an ES module.
| Runtime | require("@sinclair/typebox") | import "@sinclair/typebox" |
|---|---|---|
| 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 @sinclair/typebox
ES modules (import)
import typebox from "@sinclair/typebox";CommonJS (require)
const typebox = require("@sinclair/typebox");Module format by version
Derived from the type, main and exports fields of every stable release on npm (363 versions; the newest 60 shown).
| Versions | Format | First published |
|---|---|---|
| 0.33.18 – 0.34.52 | Dual (CommonJS + ESM) | Nov 6, 2024 |
Frequently asked
Is @sinclair/typebox ESM-only?
@sinclair/typebox@0.34.52 ships CommonJS and ESM builds. @sinclair/typebox publishes both a CommonJS entry and a native ESM entry (ESM added in 0.32.0). require("@sinclair/typebox") and import "@sinclair/typebox" both work on every supported Node.js version and in Bun.
Can I require @sinclair/typebox?
Yes. @sinclair/typebox ships a CommonJS entry, so require("@sinclair/typebox") works on every Node.js version, alongside the native ESM entry for import.
Does @sinclair/typebox work in Bun?
Yes. import "@sinclair/typebox" loaded successfully in Bun 1.4 on Sep 9, 2026.
Does @sinclair/typebox ship TypeScript types?
Yes. @sinclair/typebox 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
- @aws-sdk/credential-provider-web-identity 3.972.76CommonJS
- @aws-sdk/core 3.977.9Dual
- @swc/helpers 0.5.23Dual
- @aws-sdk/util-user-agent-node 3.973.60CommonJS
- @aws-sdk/middleware-user-agent 3.972.74CommonJS
- @jridgewell/remapping 2.3.5Dual
- @vitest/runner 4.1.11ESM-only
- @aws-sdk/middleware-logger 3.972.44CommonJS