Package Exports
- rollup-plugin-unused
- rollup-plugin-unused/out/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 (rollup-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
rollup-plugin-unused
Rollup plugin to check for unused files.
This plugin helps you to keep your repository clean: It checks for source files that are not imported during a rollup build and reports them.
Installation
With a modern (lts) version of node.js installed, use npm to install this package:
npm install --save-dev rollup-plugin-unused
Usage
Just add it your rollup.config.js, the default options should be sufficient in most use cases:
import findUnused from 'rollup-plugin-unused';
export default {
// input and other options
plugins: [
// NOTE: It's important that this plugin is added before any plugins that load files!
findUnused(),
// other plugins...
],
};
By default, the plugin looks for source files with an extension of .js
in the ./src/
folder. To change this, you can:
Set the extensions option, for example to include TypeScript files:
findUnused({ extensions: ['.js', '.ts'] });
Set the includes option to specify a different source file glob:
findUnused({ include: ['sources/**/*.mjs'] });
This will treat all
.mjs
files inside the./sources/
folder as source files.Use the exclude option to ignore some files
findUnused({ exclude: ['src/legacy/*.js'] });
This will ignore all
.js
files inside the./src/
folder.
You can combine exclude with both extensions and include, but include always overrides extensions.