# has-vite

> Check if a project is using vite

Latest version **0.3.0** (published 2025-08-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install has-vite
pnpm add has-vite
yarn add has-vite
bun add has-vite
```

## Health

**Score 45/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities; has provenance; high quality score.

Warnings: low downloads; pre 1.0.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.0 |
| Published | 2025-08-22 |
| First published | 2022-10-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 9.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 2 |
| Author | ntnyq |
| Maintainers | ntnyq |
| Keywords | check, has-vite, vite |

## Links

- npm: https://www.npmjs.com/package/has-vite
- Repository: https://github.com/ntnyq/has-vite
- Homepage: https://github.com/ntnyq/has-vite#readme
- Issues: https://github.com/ntnyq/has-vite/issues
- npm.io page: https://npm.io/package/has-vite

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 0.3.0 (latest) — 2025-08-22
- 0.2.1 — 2024-12-11
- 0.2.0 — 2023-09-20
- 0.1.0 — 2023-04-12
- 0.0.4 — 2023-03-11
- 0.0.3 — 2023-01-06
- 0.0.2 — 2022-10-28
- 0.0.1 — 2022-10-13

## README

# has-vite

[![CI](https://github.com/ntnyq/has-vite/workflows/CI/badge.svg)](https://github.com/ntnyq/has-vite/actions)
[![NPM VERSION](https://img.shields.io/npm/v/has-vite.svg)](https://www.npmjs.com/package/has-vite)
[![NPM DOWNLOADS](https://img.shields.io/npm/dy/has-vite.svg)](https://www.npmjs.com/package/has-vite)
[![LICENSE](https://img.shields.io/github/license/ntnyq/has-vite.svg)](https://github.com/ntnyq/has-vite/blob/main/LICENSE)

> Check if a project is using [vite](https://vitejs.dev/)

## Install

**npm**:

```shell
npm install has-vite
```

**yarn**

```shell
yarn add has-vite
```

**pnpm**

```shell
pnpm add has-vite
```

## Usage

```bash
.
├── foo
│   └── package.json
└── bar
    ├── package.json
    └── vite.config.ts
```

```js
import { hasVite } from 'has-vite'

hasVite('foo') // => false

hasVite('bar') // => true
```

## API

### hasVite(cwd?)

Returns a `boolean` of whether the project is using vite.

Returns `true` if one of bellow functions return `true`:

- `hasViteConfig`
- `hasViteInPkg`

### hasViteConfig(cwd?)

Returns a `boolean` of whether the project has `vite.config.{js,cjs,mjs,ts,cts,mts}`.

### hasViteDep(cwd?)

Returns a `boolean` of whether the project has `vite` in `dependencies`.

### hasViteDevDep(cwd?)

Returns a `boolean` of whether the project has `vite` in `devDependencies`.

### hasVitePeerDep(cwd?)

Returns a `boolean` of whether the project has `vite` in `peerDependencies`.

### hasViteInPkg(cwd?)

Returns a `boolean` of whether the project has `vite` in `dependencies | devDependencies | peerDependencies`.

### readPkg(cwd?)

Returns an `object` of a project's `package.json` content, returns `{}` when `package.json` not exist in `cwd`.

## Parameters

#### cwd

Current working directory.

Type: `string`

Default: `process.cwd()`

## License

[MIT](./LICENSE) License © 2022-PRESENT [ntnyq](https://github.com/ntnyq)

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