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.0.0 to 1.1.0

12

index.js

@@ -15,2 +15,12 @@ var fs = require("fs");

function containsPattern(arr, val) {
return arr && arr.some(function(pattern){
if(pattern instanceof RegExp){
return pattern.test(val);
} else {
return pattern == val;
}
});
}
module.exports = function nodeExternals(options) {

@@ -34,3 +44,3 @@ options = options || {};

var pathStart = request.split('/')[0];
if (contains(nodeModules, pathStart) && !contains(whitelist, request)) {
if (contains(nodeModules, pathStart) && !containsPattern(whitelist, request)) {
// mark this module as external

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

2

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

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

@@ -5,3 +5,4 @@ Webpack node modules externals

[![Version](http://img.shields.io/npm/v/webpack-node-externals.svg)](https://www.npmjs.org/package/webpack-node-externals)
[![Version](https://img.shields.io/npm/v/webpack-node-externals.svg)](https://www.npmjs.org/package/webpack-node-externals)
[![Downloads](https://img.shields.io/npm/dm/webpack-node-externals.svg)](https://www.npmjs.org/package/webpack-node-externals)
[![Build Status](https://travis-ci.org/liady/webpack-node-externals.svg?branch=master)](https://travis-ci.org/liady/webpack-node-externals)

@@ -40,3 +41,3 @@

#### `options.whitelist (=[])`
An array of paths for the `externals` to whitelist, so they **will** be included in the bundle.
An array of paths for the `externals` to whitelist, so they **will** be included in the bundle. Can accept regex patterns.

@@ -57,4 +58,4 @@ #### `options.importType (='commonjs')`

externals: [nodeExternals({
// this WILL include `jquery` and `webpack/hot/dev-server` in the bundle
whitelist: ['jquery', 'webpack/hot/dev-server']
// this WILL include `jquery` and `webpack/hot/dev-server` in the bundle, as well as `lodash/*`
whitelist: ['jquery', 'webpack/hot/dev-server', /^lodash/]
})],

@@ -61,0 +62,0 @@ ...

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