# Is hosted-git-info ESM-only? Can you require() it?

> hosted-git-info@10.1.1 is a CommonJS package. CommonJS — require() works on every Node.js version we test.

Provides metadata and conversions from repository urls for GitHub, Bitbucket and GitLab

Last verified Sep 9, 2026 against hosted-git-info@10.1.1.

hosted-git-info ships CommonJS only. require("hosted-git-info") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. The package declares Node.js ^22.22.2 || ^24.15.0 || >=26.0.0. 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.

## What to do

1. require("hosted-git-info") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. The package declares Node.js ^22.22.2 || ^24.15.0 || >=26.0.0.
2. From ES modules use the default import: import hostedGitInfo from "hosted-git-info"; then destructure. Named imports only work when Node.js can statically detect the exports.
3. TypeScript: npm install -D @types/hosted-git-info

## Facts

- Latest: 10.1.1 (May 18, 2026)
- Module format: CommonJS
- Last CommonJS version: 10.1.1
- TypeScript types: @types/hosted-git-info
- Node engines: ^22.22.2 || ^24.15.0 || >=26.0.0
- Weekly downloads: 90.6M
- License: ISC

## Runtime test results for hosted-git-info@10.1.1

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.0 | works | works |

## How to import hosted-git-info

ES modules:

```js
import hostedGitInfo from "hosted-git-info";
```

CommonJS:

```js
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 on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. The package declares Node.js ^22.22.2 || ^24.15.0 || >=26.0.0. 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.0 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

- [hosted-git-info on npm](https://www.npmjs.com/package/hosted-git-info)
- [Source repository](https://github.com/npm/hosted-git-info)
- [HTML version](https://canirequire.com/package/hosted-git-info/)
- [JSON version](https://canirequire.com/package/hosted-git-info.json)

---

For scripts and AI agents: any package is at https://canirequire.com/package/<name>/index.md (Markdown) or https://canirequire.com/package/<name>.json (JSON); the site index is https://canirequire.com/llms.txt. Fetch the URL directly; no search needed.
