canirequire › CommonJS › hosted-git-info
Is hosted-git-info ESM-only? Can you require() it?
Provides metadata and conversions from repository urls for GitHub, Bitbucket and GitLab
Last verified Sep 9, 2026 against hosted-git-info@10.1.1. JSON
CommonJS CommonJS — require() works on every Node.js version
hosted-git-info ships CommonJS only. require("hosted-git-info") works everywhere. import "hosted-git-info" 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 hosted-git-info@10.1.1 actually load? Runtime test results
Installed and executed on Sep 9, 2026 with require("hosted-git-info") from a CommonJS file and import "hosted-git-info" from an ES module.
| Runtime | require("hosted-git-info") | import "hosted-git-info" |
|---|---|---|
| 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 hosted-git-info
ES modules (import)
import hostedGitInfo from "hosted-git-info";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 hostedGitInfo = require("hosted-git-info");Module format by version
Derived from the type, main and exports fields of every stable release on npm (77 versions; the newest 60 shown).
| Versions | Format | First published |
|---|---|---|
| 2.1.3 – 10.1.1 | CommonJS | May 21, 2015 |
Frequently asked
Is hosted-git-info ESM-only?
hosted-git-info@10.1.1 is a CommonJS package. hosted-git-info ships CommonJS only. require("hosted-git-info") works everywhere. import "hosted-git-info" 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 hosted-git-info with ES module syntax?
Yes. import hostedGitInfo from "hosted-git-info" 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 hosted-git-info work in Bun?
Yes. import "hosted-git-info" loaded successfully in Bun 1.4 on Sep 9, 2026.
Does hosted-git-info ship TypeScript types?
Not bundled. Install the community types with "npm install -D @types/hosted-git-info".
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
- reusify 1.1.0CommonJS
- rxjs 7.8.2CommonJS
- define-properties 1.2.1CommonJS
- get-tsconfig 4.14.3Dual
- @rollup/rollup-linux-x64-gnu 4.63.1CommonJS
- gaxios 8.0.0Dual
- tough-cookie 6.0.2Dual
- path-type 6.0.0ESM-only