0.1.1 • Published 2 years ago

rollup-plugin-unused v0.1.1

Weekly downloads
59
License
MIT
Repository
github
Last release
2 years ago

rollup-plugin-unused

Rollup plugin to check for unused files.

Usage

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.

0.1.1

2 years ago

0.1.0

3 years ago

0.0.2

4 years ago

0.0.1

4 years ago

0.0.0

4 years ago