# import-local

> Let a globally installed package use a locally installed version of itself if available

Latest version **3.2.0** (published 2024-07-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install import-local
pnpm add import-local
yarn add import-local
bun add import-local
```

Provides the command `import-local-fixture`.

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.2.0 |
| Published | 2024-07-22 |
| First published | 2017-05-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=8 |
| Dependencies | 2 |
| Unpacked size | 4.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 155 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | import, local, require, resolve, global, version, prefer, cli |

## Links

- npm: https://www.npmjs.com/package/import-local
- Repository: https://github.com/sindresorhus/import-local
- Homepage: https://github.com/sindresorhus/import-local#readme
- Issues: https://github.com/sindresorhus/import-local/issues
- Funding: https://github.com/sponsors/sindresorhus
- npm.io page: https://npm.io/package/import-local

## Dependencies (2)

- [pkg-dir](https://npm.io/package/pkg-dir.md) ^4.2.0
- [resolve-cwd](https://npm.io/package/resolve-cwd.md) ^3.0.0

## Alternatives

- [@salesforce/cli](https://npm.io/package/@salesforce/cli.md) — 389.7K weekly downloads
- [@mintlify/cli](https://npm.io/package/@mintlify/cli.md) — 208.9K weekly downloads
- [@grafana/e2e-selectors](https://npm.io/package/@grafana/e2e-selectors.md) — 128.7K weekly downloads
- [mintlify](https://npm.io/package/mintlify.md) — 112.0K weekly downloads
- [@intlayer/cli](https://npm.io/package/@intlayer/cli.md) — 22.8K weekly downloads

## Recent versions

- 3.2.0 (latest) — 2024-07-22
- 3.1.0 — 2022-01-06
- 3.0.3 — 2021-10-04
- 3.0.2 — 2019-07-24
- 3.0.1 — 2019-07-07
- 3.0.0 — 2019-06-29
- 2.0.0 — 2018-08-31
- 1.0.0 — 2017-12-15
- 0.1.1 — 2017-05-06
- 0.1.0 — 2017-05-04

## README

# import-local

> Let a globally installed package use a locally installed version of itself if available

Useful for CLI tools that want to defer to the user's locally installed version when available, but still work if it's not installed locally. For example, [AVA](https://avajs.dev) and [XO](https://github.com/xojs/xo) uses this method.

## Install

```sh
npm install import-local
```

## Usage

```js
import importLocal from 'import-local';

if (importLocal(import.meta.url)) {
	console.log('Using local version of this package');
} else {
	// Code for both global and local version here…
}
```

You can also pass in `__filename` when used in a CommonJS context.

---
_Source: https://npm.io/package/import-local · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
