webpack-unused-scaner
A webpack plugin to find unused modules/source files
Last updated a year ago by rainpure .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install webpack-unused-scaner 
SYNC missed versions from official npm registry.

WebpackUnusedScaner

A webpack plugin to find unused modules/source files and remove them.

webpack-unused-scaner

Install

npm i --dev webpack-unused-scaner

Usage

DEMO

const path = require('path');
const WebpackUnusedScaner = require('webpack-unused-scaner');

module.exports = {
  // webpack configuration
  plugins: [
    ...otherPlugins,
    new WebpackUnusedScaner({
      // Source directories
      directories: [path.join(__dirname, 'src')],
      // Exclude patterns
      exclude: ['*.test.js'],
      // Root directory (optional)
      root: __dirname,
      // Remove files (optional)
      remove: false,
    }),
  ],
};

Options

  • directories : array of directories where to look for unused source files.
  • exclude : array of exclude patterns when looking for unused source files.
  • root : root directory that will be use to display relative paths instead of absolute ones (see below)
  • failOnUnused: whether or not the build should fail if unused files are found (defaults to false)
  • useGitIgnore: whether or not to respect .gitignore file (defaults to true)
  • remove: whether or not to remove all unused source files (defaults to false)

With root

With root

Without root

Without root

Related

Add DELETE option for unused-webpack-plugin.

Current Tags

  • 1.0.2                                ...           latest (a year ago)

3 Versions

  • 1.0.2                                ...           a year ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 17
This Week 72
This Month 73
Last Day 42
Last Week 26
Last Month 63
Dependencies (3)
Dev Dependencies (8)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |