remove-unwantedjs-webpack-plugin

0.1.5 • Public • Published

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'}
 

/remove-unwantedjs-webpack-plugin/

    Package Sidebar

    Install

    npm i remove-unwantedjs-webpack-plugin

    Weekly Downloads

    1

    Version

    0.1.5

    License

    MIT

    Unpacked Size

    6 kB

    Total Files

    4

    Last publish

    Collaborators

    • darshanags