remove-unwantedjs-webpack-plugin
A Webpack 4 plugin that automatically removes .js files created as a by-product when the entry is a sass/scss file.
Note that this has only been tested with Webpack 4.
Installation
npm install remove-unwantedjs-webpack-plugin --save-dev
Usage
// webpack.config.js...const RemoveUnwantedJsWebpackPlugin = ;...const config = ... plugins: ...; moduleexports = config;
Tested Scenarios
The following scenarios will result in extra js files being automatically deleted by the plugin.
entry: './src/scss/new.scss' OR entry: './src/scss/new.scss' './src/scss/hello.scss' OR entry: new:'./src/scss/new.scss' hello:'./src/scss/hello.scss' OR entry: somename:'./src/scss/new.scss' home:'./src/scss/hello.scss' OR entry: somename:'./src/scss/new.scss' hello:'./src/js/hello.js'
However, the plugin will not delete js files generated by the following scenarios, even though the entry point may import/require scss files within them:
entry: './src/js/one.js' OR entry: './src/scss/new.scss' './src/js/one.js' OR entry: './src/js/one.js' './src/js/hello.js' OR entry: one:'./src/js/one.js' hello:'./src/js/hello.js'