AnujRNair / webpack-extraneous-file-cleanup-plugin

A webpack plugin to remove unwanted files which may have been created and output due to multiple entry points
MIT License
25 stars 10 forks source link

Plugin removing html files generated by html-webpack-plugin #10

Closed ktunkiewicz closed 6 years ago

ktunkiewicz commented 6 years ago
  plugins: [
    //new ExtraneousFileCleanupPlugin(),
    new HtmlWebPackPlugin(),
  ],

results in:

                   Asset       Size                 Chunks             Chunk Names
           calculator.js   1.87 MiB             calculator  [emitted]  calculator
              index.html  194 bytes                         [emitted]

But the:

  plugins: [
    new ExtraneousFileCleanupPlugin(),
    new HtmlWebPackPlugin(),
  ],

results in:

                   Asset      Size                 Chunks             Chunk Names
           calculator.js  1.87 MiB             calculator  [emitted]  calculator
AnujRNair commented 6 years ago

This is actually the intended functionality of the plugin - it is unopinionated about which files it removes - they only have to have a minimum byte size.

The recommended config for this plugin is:

new ExtraneousFileCleanupPlugin({
  extensions: ['.js']
})

Only js files below 1024 bytes will be removed then :)