Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

webpack-node-externals

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webpack-node-externals - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

14

index.js

@@ -42,2 +42,10 @@ var fs = require("fs");

function getModuleName(request, modulesDir) {
var req = request;
// in case absolute, strip all parts before */modulesDir/
req = req.replace(/^\/.*?node_modules\//, '');
// return the module name
return req.split('/')[0];
}
module.exports = function nodeExternals(options) {

@@ -57,8 +65,8 @@ options = options || {};

// create the node modules list
var nodeModules = modulesFromFile ? readFromPackageJson(): readDir(modulesDir).filter(isNotBinary);
var nodeModules = modulesFromFile ? readFromPackageJson() : readDir(modulesDir).filter(isNotBinary);
// return an externals function
return function(context, request, callback) {
var pathStart = request.split('/')[0];
if (contains(nodeModules, pathStart) && !containsPattern(whitelist, request)) {
var moduleName = getModuleName(request);
if (contains(nodeModules, moduleName) && !containsPattern(whitelist, request)) {
// mark this module as external

@@ -65,0 +73,0 @@ // https://webpack.github.io/docs/configuration.html#externals

{
"name": "webpack-node-externals",
"version": "1.2.0",
"version": "1.3.0",
"description": "Easily exclude node_modules in Webpack bundle",

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

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