Socket
Socket
Sign inDemoInstall

webpack-node-externals

Package Overview
Dependencies
0
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.0 to 2.2.0

2

package.json
{
"name": "webpack-node-externals",
"version": "2.1.0",
"version": "2.2.0",
"description": "Easily exclude node_modules in Webpack bundle",

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

@@ -55,2 +55,5 @@ Webpack node modules externals

#### `options.additionalModuleDirs (='[]')`
Additional folders to look for node modules.
#### `options.modulesFromFile (=false)`

@@ -64,4 +67,4 @@ Read the modules from the `package.json` file instead of the `node_modules` folder.

modulesFromFile: {
exclude: [/* sections to exclude, i.e 'devDependencies' */],
include: [/* sections to explicitly include, i.e only 'dependencies' */]
includeInBundle: [/* whole sections to include in the bundle, i.e 'devDependencies' */],
excludeFromBundle: [/* whole sections to explicitly exclude from the bundle, i.e only 'dependencies' */]
}

@@ -68,0 +71,0 @@ }

@@ -40,2 +40,5 @@ var fs = require('fs');

}
var includeInBundle = options.exclude || options.includeInBundle;
var excludeFromBundle = options.include || options.excludeFromBundle;
// read the file

@@ -52,8 +55,8 @@ var packageJson;

var sections = ['dependencies', 'devDependencies', 'peerDependencies', 'optionalDependencies'];
if(options.include) {
sections = [].concat(options.include);
if(excludeFromBundle) {
sections = [].concat(excludeFromBundle);
}
if(options.exclude) {
if(includeInBundle) {
sections = sections.filter(function(section){
return [].concat(options.exclude).indexOf(section) === -1;
return [].concat(includeInBundle).indexOf(section) === -1;
});

@@ -60,0 +63,0 @@ }

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc