# vite-plugin-replace

> With this plugin text in sourcecode could be replaced before bundling.

Latest version **0.1.1** (published 2021-04-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install vite-plugin-replace
pnpm add vite-plugin-replace
yarn add vite-plugin-replace
bun add vite-plugin-replace
```

## Health

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

Positive: no vulnerabilities; high maintenance score.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2021-04-02 |
| First published | 2021-04-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 34 |
| Author | Martin Oppitz |
| Maintainers | m.oppitz |
| Keywords | vite, plugin, replace |

## Links

- npm: https://www.npmjs.com/package/vite-plugin-replace
- Repository: https://github.com/leanupjs/leanup
- Homepage: https://leanupjs.org
- Issues: https://github.com/leanupjs/leanup/issues
- npm.io page: https://npm.io/package/vite-plugin-replace

## 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.1.1 (latest) — 2021-04-02
- 0.1.0 — 2021-04-02

## README

# Vite Plugin Replace

With this plugin text in sourcecode could be replaced before bundling.

## Installation

```bash
npm i -D vite-plugin-replace
```

## Usage

```js
import packageJson from "./package.json";
import { replaceCodePlugin } from "vite-plugin-replace";

module.exports = mergeConfig(config, {
  plugins: [
    replaceCodePlugin({
      replacements: [
        {
          from: "__CLI_NAME__",
          to: packageJson.name,
        },
        {
          from: /__CLI_VERSION__/g,
          to: packageJson.version,
        },
      ],
    }),
  ],
});
```

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