Package Exports
- esbuild-plugin-unused
- esbuild-plugin-unused/src/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (esbuild-plugin-unused) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
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
> 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;
}