New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

unused-webpack-plugin

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unused-webpack-plugin - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

1

example/webpack.config.js

@@ -22,4 +22,5 @@ const path = require('path');

root: __dirname,
failOnUnused: true
}),
],
};

@@ -9,2 +9,3 @@ const path = require('path');

this.root = options.root;
this.failOnUnused = options.failOnUnused || false;
}

@@ -36,2 +37,3 @@

.then(display.bind(this))
.then(continueOrFail.bind(this, this.failOnUnused, compilation))
.then(callback);

@@ -44,2 +46,12 @@ }.bind(this)

function continueOrFail(failOnUnused, compilation, allFiles) {
if (allFiles && allFiles.length > 0) {
if (failOnUnused) {
compilation.errors.push(new Error("Unused files found"));
} else {
compilation.warnings.push(new Error("Unused files found"));
}
}
}
function display(filesByDirectory) {

@@ -71,2 +83,4 @@ const allFiles = filesByDirectory.reduce(

process.stdout.write(chalk.green('\n*** Unused Plugin ***\n\n'));
return allFiles;
}

2

package.json
{
"name": "unused-webpack-plugin",
"version": "1.0.0",
"version": "1.1.0",
"description": "A webpack plugin to find unused modules/source files",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -40,6 +40,10 @@ # UnusedWebpackPlugin

- `root` : root directory that will be use to display relative paths instead of absolute ones (see below)
- `failOnUnused`: whether or not the build should fail if unused files are found (defaults to `false`)
With root
![With root](images/with-root.png)
Without root
![Without root](images/without-root.png)

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc