# rollup-plugin-dce

> A rollup plugin that fails when you have dead code anywhere

Latest version **0.1.0** (published 2019-05-04) · LGPL-3.0 license · 0 weekly downloads

## Install

```sh
npm install rollup-plugin-dce
pnpm add rollup-plugin-dce
yarn add rollup-plugin-dce
bun add rollup-plugin-dce
```

## Health

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

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

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2019-05-04 |
| First published | 2019-05-04 |
| Weekly downloads | 0 |
| License | LGPL-3.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 12 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Arpad Borsos |
| Maintainers | swatinem |
| Keywords | rollup-plugin |

## Links

- npm: https://www.npmjs.com/package/rollup-plugin-dce
- Repository: https://github.com/Swatinem/rollup-plugin-dce
- Homepage: https://github.com/Swatinem/rollup-plugin-dce#readme
- Issues: https://github.com/Swatinem/rollup-plugin-dce/issues
- npm.io page: https://npm.io/package/rollup-plugin-dce

## Dependencies (2)

- [glob](https://npm.io/package/glob.md) ^7.1.3
- [rollup-plugin-dts](https://npm.io/package/rollup-plugin-dts.md) ^0.15.1

## 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.0 (latest) — 2019-05-04

## README

# rollup-plugin-dce

[![Build Status](https://img.shields.io/travis/Swatinem/rollup-plugin-dce.svg)](https://travis-ci.org/Swatinem/rollup-plugin-dce)
[![Coverage Status](https://img.shields.io/codecov/c/github/Swatinem/rollup-plugin-dce.svg)](https://codecov.io/gh/Swatinem/rollup-plugin-dce)

## Usage

Install the package from `npm`:

    $ npm install --save-dev rollup rollup-plugin-dce

Add it to your `rollup.config.js`:

```js
import dce from "rollup-plugin-dce";

const config = [
  {
    input: "./src/index.ts",
    output: [{ file: "dist/my-library.js", format: "cjs" }, { file: "dist/my-library.mjs", format: "es" }],

    plugins: [
      ts(),
      dce({
        sourceGlob: "./src/**/*.ts",
      }),
    ],
  },
];

export default config;
```

## TypeScript support

For TypeScript projects, this plugin integrates with
[rollup-plugin-dts](https://github.com/Swatinem/rollup-plugin-dts)
and can report dead non-emit items, such as `interface` and `type` declarations.

As this requires two passes, one for the transpiled `.js` code, and another for
the type definitions of `.d.ts` files, using this plugin as part of a
`rollup.config` can lead to false positives.

For this reason, it is recommended to programmatically analyze a TypeScript
project like so:

```ts
import { analyzeTSProject } from "rollup-plugin-dce";

const { files: filesWithDeadCode } = await analyzeTSProject({
  input: "./src/index.ts",
  sourceGlob: "./src/**/*.ts",
});
```

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