Hi I have a webpack config with these entry points:
entry: {
\'polyfills\': \'./src/polyfills.ts\',
\'vendor\': \'./src/vendor.ts\',
\'app
I put together a webpack plugin to remove extra files based on their output size, rather than basing it on their name - it's been a little more future proof for me as I continue to add extra entry points to my webpack config.
Install using npm or yarn
npm install webpack-extraneous-file-cleanup-plugin --save-dev
yarn add webpack-extraneous-file-cleanup-plugin --dev
In your webpack.config.js file:
const ExtraneousFileCleanupPlugin = require('webpack-extraneous-file-cleanup-plugin');
module.exports = {
...
plugins: [
new ExtraneousFileCleanupPlugin({
extensions: ['.js']
})
]
}
You can see the full list of options on the Webpack Extraneous File Cleanup Plugin Github Page