esbuild-plugin-unused
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

esbuild-plugin-unused

Find unused files in your esbuild project.

Installation

yarn add -D esbuild-plugin-unused
npm i -D esbuild-plugin-unused
pnpm add -D esbuild-plugin-unused

Usage

Add the plugin to your esbuild config.

const unused = require("esbuild-plugin-unused");

require("esbuild").build({
  entryPoints: ["src/"],
  bundle: true,
  outfile: "dist/out.js",
  plugins: [unused()],
})

On build completion, you will get some console output telling you which files in your project are unused.

~/project ❯ pnpm build

> project@1.0.0 build /user/project
> node ./build.js

Found 2 Unused Files
- /user/project/src/unused.js
- /user/project/src/lib/unused.js

This plugin works by finding files that were not used during the onLoad build step.

Options

export interface Options {
  // source file glob expression
  // defaults to src/**/*
  src?: string | string[];
  // Regular expression to filter files on.
  // defaults to `/.*\.(m|c)?(j|t)sx?$/` which should match all JavaScript and TypeScript file extensions
  filter?: RegExp;
}

Readme

Keywords

Package Sidebar

Install

npm i esbuild-plugin-unused

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

3.04 kB

Total Files

4

Last publish

Collaborators

  • ec965