webpack-clean-obsolete-chunks

A webpack plugin to remove obsolete chunk files in webpack watch mode

Usage no npm install needed!

<script type="module">
  import webpackCleanObsoleteChunks from 'https://cdn.skypack.dev/webpack-clean-obsolete-chunks';
</script>

README

webpack-clean-obsolete-chunks

npm version Coverage Status Build Status dependencies devDependencies Code Climate

A webpack plugin to remove obsolete chunk files in webpack watch mode. Especially useful when use hashes in output file names.

Installation

Via yarn:

yarn add webpack-clean-obsolete-chunks --dev

or via npm:

npm install webpack-clean-obsolete-chunks --save-dev

Usage

Just add this plugin as usual.

// webpack.config.js
var CleanObsoleteChunks = require('webpack-clean-obsolete-chunks');

module.exports = {
    // ...
    plugins: [
        new CleanObsoleteChunks(options)
    ]
    // ...
};

Options

{
  // Write logs to console.
  // Default: true
  verbose: true,

  // Clean obsolete chunks of webpack child compilations.
  // Default: false
  deep: true
}

NOTE: {deep: true} option will work only if all descendent compilations of the initial compilation have unique names

How it works

Plugin searches for all updated chunks and deletes obsolete files in output directory after each webpack compilation.

Support

We currently support Node.js of version ^6, ^7, ^8 and Webpack of version ^2, ^3, or ^4 (but ^1 should work also).

Contribution

You're free to contribute to this project by submitting issues and/or pull requests. Please be sure to read the contribution guidelines before making changes for a pull request.

License

This project is licensed under MIT.