esbuild-plugin-unused
v1.0.0
Published
Find unused files in your esbuild project.
Downloads
204
Readme
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
> [email protected] 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;
}