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. JSON
Dual (CommonJS + ESM) Dual package — both require() and import work
@swc/helpers publishes both a CommonJS entry and a native ESM entry (ESM added in 0.4.15). require("@swc/helpers") and import "@swc/helpers" both work on every supported Node.js version and in Bun.
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.
| Runtime | require("@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 | ✓ works | ✓ works |
How to import @swc/helpers
ES modules (import)
import helpers from "@swc/helpers";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 (81 versions; the newest 60 shown).
| Versions | Format | First published |
|---|---|---|
| 0.4.15 – 0.5.23 | Dual (CommonJS + ESM) | Aug 17, 2023 |
| 0.3.6 – 0.4.14 | CommonJS | Feb 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") and import "@swc/helpers" both work on every supported Node.js version and in Bun.
Can I require @swc/helpers?
Yes. @swc/helpers ships a CommonJS entry, so require("@swc/helpers") works on every Node.js version, alongside the native ESM entry for import.
Does @swc/helpers work in Bun?
Yes. import "@swc/helpers" loaded successfully in Bun 1.4 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
- 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-env 3.972.70CommonJS
- @sinonjs/fake-timers 15.4.0CommonJS
- @aws-sdk/credential-provider-web-identity 3.972.76CommonJS
- @aws-sdk/core 3.977.9Dual
- @aws-sdk/util-user-agent-node 3.973.60CommonJS
- @sinclair/typebox 0.34.52Dual
- @aws-sdk/middleware-user-agent 3.972.74CommonJS
- @jridgewell/remapping 2.3.5Dual