canirequire

canirequire › Dual (CommonJS + ESM) › @swc/helpers

Is @swc/helpers ESM-only? Can you require() it?

External helpers for the swc project.

Last verified Sep 9, 2026 against @swc/helpers@0.5.23. Markdown · JSON

Dual (CommonJS + ESM) Dual package — require() works on every Node.js version we test; import works too

@swc/helpers publishes both a CommonJS entry and a native ESM entry (ESM added in 0.4.15). require("@swc/helpers") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. import "@swc/helpers" works alongside it.

What to do

  1. Nothing to change. require("@swc/helpers") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. import * as helpers from "@swc/helpers" works alongside it; use named imports for what the ESM entry exports.
  2. TypeScript: no types are available for @swc/helpers; declare the module yourself if you need them.
Latest
0.5.23 (May 27, 2026)
Module format
Dual (CommonJS + ESM)
Last CommonJS version
0.5.23
Native ESM since
0.4.15
TypeScript types
None
Node engines
not declared
Weekly downloads
79.4M
License
Apache-2.0

Does @swc/helpers@0.5.23 actually load? Runtime test results

Installed and executed on Sep 9, 2026 with require("@swc/helpers") from a CommonJS file and import "@swc/helpers" from an ES module.

Runtimerequire("@swc/helpers")import "@swc/helpers"
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 @swc/helpers

ES modules (import)

import * as helpers from "@swc/helpers";

Namespace import shown because the ESM entry may have no default export; use named imports for what it exports.

CommonJS (require)

const helpers = require("@swc/helpers");

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 (81 versions; the newest 60 shown).

VersionsFormatFirst published
0.4.15 – 0.5.23Dual (CommonJS + ESM)Aug 17, 2023
0.3.6 – 0.4.14CommonJSFeb 27, 2022

Frequently asked

Is @swc/helpers ESM-only?

@swc/helpers@0.5.23 ships CommonJS and ESM builds. @swc/helpers publishes both a CommonJS entry and a native ESM entry (ESM added in 0.4.15). require("@swc/helpers") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. import "@swc/helpers" works alongside it.

Can I require @swc/helpers?

Yes. @swc/helpers ships a CommonJS entry alongside the native ESM entry. require("@swc/helpers") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun.

Does @swc/helpers work in Bun?

Yes. import "@swc/helpers" loaded successfully in Bun 1.4.0 on Sep 9, 2026.

Does @swc/helpers ship TypeScript types?

No. @swc/helpers ships no type declarations and there is no @types package for it.

Links

Other dual (commonjs + esm) packages

Similar popularity