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.4.3 to 1.4.4

2

index.js

@@ -37,2 +37,4 @@ var fs = require("fs");

return pattern.test(val);
} else if (typeof pattern === 'function') {
return pattern(val);
} else {

@@ -39,0 +41,0 @@ return pattern == val;

2

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

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

@@ -40,3 +40,3 @@ Webpack node modules externals

#### `options.whitelist (=[])`
An array of paths for the `externals` to whitelist, so they **will** be included in the bundle. Can accept exact strings (`'module_name'`) or regex patterns (`/^module_name/`).
An array for the `externals` to whitelist, so they **will** be included in the bundle. Can accept exact strings (`'module_name'`), regex patterns (`/^module_name/`), or a function that accepts the module name and returns whether it should be included.
<br/>**Important** - if you have set aliases in your webpack config with the exact same names as modules in *node_modules*, you need to whitelist them so Webpack will know they should be bundled.

@@ -85,2 +85,14 @@

#### How can I bundle required assets (i.e css files) from node_modules?
Using the `whitelist` option, this is possible. We can simply tell Webpack to bundle all files with extensions that are not js/jsx/json, using this [regex](https://regexper.com/#%5C.(%3F!(%3F%3Ajs%7Cjson)%24).%7B1%2C5%7D%24):
```js
...
nodeExternals({
// load non-javascript files with extensions, presumably via loaders
whitelist: [/\.(?!(?:jsx?|json)$).{1,5}$/i],
}),
...
```
Thanks @wmertens for this idea.
## Contribute

@@ -87,0 +99,0 @@ Contributions and pull requests are welcome. Please run the tests to make sure nothing breaks.

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