canirequire

canirequireDual (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.

Latest
0.34.52 (Jul 11, 2026)
Module format
Dual (CommonJS + ESM)
Last CommonJS version
0.34.52
Native ESM since
0.32.0
TypeScript types
Bundled
Node engines
not declared
License
MIT

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.

Runtimerequire("@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).

VersionsFormatFirst published
0.33.18 – 0.34.52Dual (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

Similar popularity