canirequire › Dual (CommonJS + ESM) › pure-rand
Is pure-rand ESM-only? Can you require() it?
Pure random number generator written in TypeScript
Last verified Sep 9, 2026 against pure-rand@8.4.2. JSON
Dual (CommonJS + ESM) Dual package — both require() and import work
pure-rand publishes both a CommonJS entry and a native ESM entry (ESM added in 4.1.2). require("pure-rand") and import "pure-rand" both work on every supported Node.js version and in Bun.
Does pure-rand@8.4.2 actually load? Runtime test results
Installed and executed on Sep 9, 2026 with require("pure-rand") from a CommonJS file and import "pure-rand" from an ES module.
| Runtime | require("pure-rand") | import "pure-rand" |
|---|---|---|
| Node.js 18 | ✗ failsERR_PACKAGE_PATH_NOT_EXPORTED | ✗ failsERR_PACKAGE_PATH_NOT_EXPORTED |
| Node.js 20 | ✗ failsERR_PACKAGE_PATH_NOT_EXPORTED | ✗ failsERR_PACKAGE_PATH_NOT_EXPORTED |
| Node.js 22 | ✗ failsERR_PACKAGE_PATH_NOT_EXPORTED | ✗ failsERR_PACKAGE_PATH_NOT_EXPORTED |
| Node.js 24 | ✗ failsERR_PACKAGE_PATH_NOT_EXPORTED | ✗ failsERR_PACKAGE_PATH_NOT_EXPORTED |
| Node.js 26 | ✗ failsERR_PACKAGE_PATH_NOT_EXPORTED | ✗ failsERR_PACKAGE_PATH_NOT_EXPORTED |
| Bun 1.4 | ✗ failserror: Cannot find package 'pure-rand' from '/Users/boat/Projects/top-seo/data/probe-work/pure-rand/req.cjs' | ✗ failserror: Cannot find package 'pure-rand' from '/Users/boat/Projects/top-seo/data/probe-work/pure-rand/imp.mjs' |
A failing require() on a CommonJS package usually means the package needs a browser/DOM global, a peer dependency, or a native binary that is not available in a bare Node.js process.
How to import pure-rand
ES modules (import)
import pureRand from "pure-rand";CommonJS (require)
const pureRand = require("pure-rand");Module format by version
Derived from the type, main and exports fields of every stable release on npm (46 versions; the newest 46 shown).
| Versions | Format | First published |
|---|---|---|
| 4.1.2 – 8.4.2 | Dual (CommonJS + ESM) | Jan 25, 2021 |
| 0.0.0 – 4.1.1 | CommonJS | Mar 1, 2018 |
Frequently asked
Is pure-rand ESM-only?
pure-rand@8.4.2 ships CommonJS and ESM builds. pure-rand publishes both a CommonJS entry and a native ESM entry (ESM added in 4.1.2). require("pure-rand") and import "pure-rand" both work on every supported Node.js version and in Bun.
Can I require pure-rand?
Yes. pure-rand ships a CommonJS entry, so require("pure-rand") works on every Node.js version, alongside the native ESM entry for import.
Does pure-rand work in Bun?
Importing pure-rand failed in Bun 1.4 on Sep 9, 2026: error: Cannot find package 'pure-rand' from '/Users/boat/Projects/top-seo/data/probe-work/pure-rand/imp.mjs'
Does pure-rand ship TypeScript types?
No. pure-rand 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
- socks 2.8.10CommonJS
- unplugin 3.3.0ESM-only
- deep-eql 5.0.2ESM-only
- socks-proxy-agent 10.1.0ESM-only
- array-includes 3.1.9CommonJS
- setimmediate 1.0.5CommonJS
- loader-utils 3.3.1CommonJS
- jsonwebtoken 9.0.3CommonJS