canirequire › CommonJS › function.prototype.name
Is function.prototype.name ESM-only? Can you require() it?
An ES2015 spec-compliant `Function.prototype.name` shim
Last verified Sep 9, 2026 against function.prototype.name@1.2.0. JSON
CommonJS CommonJS — require() works on every Node.js version
function.prototype.name ships CommonJS only. require("function.prototype.name") works everywhere. import "function.prototype.name" also works because Node.js and Bun can import CommonJS from ES modules, but only the default export is guaranteed; named imports depend on Node's static analysis of the module.
Does function.prototype.name@1.2.0 actually load? Runtime test results
Installed and executed on Sep 9, 2026 with require("function.prototype.name") from a CommonJS file and import "function.prototype.name" from an ES module.
| Runtime | require("function.prototype.name") | import "function.prototype.name" |
|---|---|---|
| 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 function.prototype.name
ES modules (import)
import functionPrototypeName from "function.prototype.name";Named imports from a CommonJS package only work when Node.js can statically detect them. If a named import fails, use the default import and destructure.
CommonJS (require)
const functionPrototypeName = require("function.prototype.name");Module format by version
Derived from the type, main and exports fields of every stable release on npm (14 versions; the newest 14 shown).
| Versions | Format | First published |
|---|---|---|
| 1.0.0 – 1.2.0 | CommonJS | Feb 27, 2016 |
Frequently asked
Is function.prototype.name ESM-only?
function.prototype.name@1.2.0 is a CommonJS package. function.prototype.name ships CommonJS only. require("function.prototype.name") works everywhere. import "function.prototype.name" also works because Node.js and Bun can import CommonJS from ES modules, but only the default export is guaranteed; named imports depend on Node's static analysis of the module.
Can I import function.prototype.name with ES module syntax?
Yes. import functionPrototypeName from "function.prototype.name" works in Node.js and Bun because they support importing CommonJS modules. Named imports work only when Node.js can statically detect the exports.
Does function.prototype.name work in Bun?
Yes. import "function.prototype.name" loaded successfully in Bun 1.4 on Sep 9, 2026.
Does function.prototype.name ship TypeScript types?
Yes. function.prototype.name bundles its own type declarations; no @types package is needed.
Links
Other commonjs packages
- debug 4.4.3CommonJS
- semver 7.8.5CommonJS
- ms 2.1.3CommonJS
- picomatch 4.0.7CommonJS
- ajv 8.20.0CommonJS
- source-map 0.8.0CommonJS
- react-is 19.2.8CommonJS
- readable-stream 4.7.0CommonJS
Similar popularity
- esprima 4.0.1CommonJS
- json-parse-even-better-errors 6.0.0CommonJS
- protobufjs 8.8.0CommonJS
- @aws-sdk/credential-provider-node 3.972.82CommonJS
- split2 4.2.0CommonJS
- decimal.js 10.6.0Dual
- is-array-buffer 3.0.5CommonJS
- string.prototype.trimstart 1.0.8CommonJS