JSPM

webpack-unused-files-plugin

1.0.4
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4
  • Score
    100M100P100Q29595F
  • License ISC

find ununsed files from your project

Package Exports

  • webpack-unused-files-plugin

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 (webpack-unused-files-plugin) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

webpack-unused-files-plugin

find unused files from your project.

Usage

yarn add webpack-unused-files-plugin

or

npm install webpack-unused-files-plugin

const WebpackUnusedFilesPlugin = require('webpack-unused-files-plugin');

// webpack config
module.exports = {
  plugins: [
    new WebpackUnusedFilesPlugin(options),
  ]
}

Options

const defaultOptions = {
  context: '',
  patterns: [
    "!**/node_modules",
    "!**/(test|tests)/**"
  ],
  sort: null, // 'ext'
  strict: false,
}
options type describe default required
context string target folder webpack.context false
patterns []string glob patterns !**/node_modules !**/test false
sort any how to display unused files, ext will sort files by extension null false
strict boolean throw an error when plugin find unused file false false

Example

config = {
  plugins: [
    new WebpackUnusedFilesPlugin({
      context: path.join(__dirname, 'src'), // find basic at src directory
      patterns: [ // NOTE: plugin will extend .gitignore
        "!**/*.log"
      ],
      sort: "ext", // plugin will sort unused file by file extenstion
      strict: true, // webpack compilcation build failed with an error
    }),
  ],
}