canirequire

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

Latest
8.4.2 (Jul 10, 2026)
Module format
Dual (CommonJS + ESM)
Last CommonJS version
8.4.2
Native ESM since
4.1.2
TypeScript types
None
Node engines
not declared
Weekly downloads
50.9M
License
MIT

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.

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

VersionsFormatFirst published
4.1.2 – 8.4.2Dual (CommonJS + ESM)Jan 25, 2021
0.0.0 – 4.1.1CommonJSMar 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

Similar popularity