Détail du package

@4c/unused-files-webpack-plugin

4Catalyzer2.4kMIT4.0.0

Glob all files that are not compiled by webpack under webpack's context

unused, redundancy, files, require

readme

unused-files-webpack-plugin

Glob all files that are not compiled by webpack under webpack's context

Version Travis CI Quality Coverage Dependencies Gitter

Install with npm:

npm i --save-dev unused-files-webpack-plugin

Install with yarn:

yarn add --dev unused-files-webpack-plugin

Usage

webpack.config.babel.js

import UnusedFilesWebpackPlugin from "unused-files-webpack-plugin";

export default {
  plugins: [
    new UnusedFilesWebpackPlugin(options),
  ],
};

webpack.config.js

const { UnusedFilesWebpackPlugin } = require("unused-files-webpack-plugin");

module.exports = {
  plugins: [
    new UnusedFilesWebpackPlugin(options),
  ],
};

Options

new UnusedFilesWebpackPlugin(options)

options.patterns

The (array of) pattern(s) to glob all files within the context.

options.failOnUnused

Emit error instead of warning in webpack compilation result.

  • Default: false
  • Explicitly set it to true to enable this feature

options.globOptions

The options object pass to second parameter of glob-all.

globOptions.ignore

Ignore pattern for glob. Can be a String or an Array of String.

globOptions.cwd

Current working directory for glob. If you don't set explicitly, it defaults to the context specified by your webpack compiler at runtime.

Contributing

devDependency Status

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

changelog

Change Log

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

4.0.0 (2019-08-30)

Features

BREAKING CHANGES

  • remove support for old node

3.4.0 (2018-03-14)

Features

  • package.json: upgrade dependencies and devDependencies (250a6cb)

3.3.0 (2018-03-14)

Features

3.2.0 (2017-10-23)

Features

  • index.js: support multiple patterns (961b1d1), closes #2
  • package.json: add glob-all and warning to dependencies (3961606)
  • package.json: remove glob from dependencies (03e08b6)

3.1.0 (2017-10-21)

Features

  • index.js: rewrite with async function (0754e72)
  • package.json: add babel-runtime, semver and util.promisify to dependencies (28cf6c5)

3.0.2 (2017-06-13)

Bug Fixes

  • index.js: avoid creating a new object in reduce loop (8dcf206)

3.0.1 (2017-02-13)

Bug Fixes

  • index.js: prevent freeze when using dev server without bail (#12) (b397e8d)

3.0.0 (2016-09-22)

Bug Fixes

  • CHANGELOG.md: deprecated v2.0.5 (b7dfd07)
  • index.js: if bail is set, callback with error (14b510a)

BREAKING CHANGES

  • index.js: error reporting behaviour changed when bail is set

Before: if bail is set, there's still an error from UnusedFilesWebpackPlugin

After: if bail is set, no error will be emitted by UnusedFilesWebpackPlugin

(Deprecated) 2.0.5 (2016-09-20)

Deprecated due to https://github.com/tomchentw/unused-files-webpack-plugin/pull/11#issuecomment-248652421

Bug Fixes

  • index.js: if bail is set, callback with error (#11) (23b85ad), closes #10

2.0.4 (2016-07-14)

2.0.3 (2016-05-30)

2.0.2 (2016-01-25)

2.0.1 (2016-01-22)

2.0.0 (2016-01-22)

Features

  • src: rewrite in ES2015 format (9a61f21)

BREAKING CHANGES

  • src: Removes commonjs module support.

Before:

// webpack.config.js
var UnusedFilesWebpackPlugin = require("unused-files-webpack-plugin");

After:

In ES2015 module format:

import UnusedFilesWebpackPlugin from "unused-files-webpack-plugin";
// it's the same as
import { default as UnusedFilesWebpackPlugin } from "unused-files-webpack-plugin";
// You could access from named export as well.
import { UnusedFilesWebpackPlugin } from "unused-files-webpack-plugin";

If you still use commonjs:

var UnusedFilesWebpackPlugin = require("unused-files-webpack-plugin").default;
// or named export
var UnusedFilesWebpackPlugin = require("unused-files-webpack-plugin").UnusedFilesWebpackPlugin;
// with destructive assignment
var { UnusedFilesWebpackPlugin } = require("unused-files-webpack-plugin");

1.3.0 (2015-09-07)

Features

  • options: add failOnUnused to enable generating error (7b7620d8, closes #3)

1.2.0 (2015-07-11)

Features

  • globOptions: makes ignore option overidable (6b630944, closes #1)

Breaking Changes

  • globOptions.ignore is now overridable

    If you choose to override globOptions with new ignore option, make sure you'll include node_modules/**/* for the new ignore.

    (6b630944)

1.1.0 (2015-05-22)

Bug Fixes

  • UnusedFilesWebpackPlugin:
    • use objectAssign for default values (f8a2b6f2)
    • include emitted assets in fileDepsMap (896e8e23)

1.0.0 (2015-05-22)

Features

  • UnusedFilesWebpackPlugin: use glob to select files (f8e081e8)