remove-unwantedjs-webpack-plugin
v0.1.5
Published
A Webpack plugin that automatically removes .js files created as a by-product when the entry is a sass/scss file
Downloads
4
Maintainers
Readme
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 = require('remove-unwantedjs-webpack-plugin');
...
const config = [{
...
plugins: [
new RemoveUnwantedJsWebpackPlugin()
]
...
}];
module.exports = 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'}