Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
webpack-aws-externals
Advanced tools
Easily exclude node_modules provided by AWS Lambda in Webpack bundle
Easily exclude node modules that are commonly included in AWS Lambda runtimes from Webpack
This module builds on webpack-node-externals which is a super handy plugin for Webpack. Webpack-aws-externals will make sure that the core list of modules that are known to be distributed within AWS lambdaLambda node runtimes will not be bundled into your webpack - but everything else will be. This way your uploaded packages for serverless lambdas wont have unnecessary bloat, but you won't have to keep track of a whitelist.
npm install webpack-aws-externals --save-dev
In your webpack.config.js
:
var awsExternals = require('webpack-aws-externals');
...
module.exports = {
...
target: 'node', // in order to ignore built-in modules like path, fs, etc.
externals: [awsExternals()], // in order to ignore all modules in node_modules folder
...
};
And that's it. All aws modules will no longer be bundled but will be left as require('module')
.
This library accepts an options
object.
options.whitelist (=[])
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.
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.
options.importType (='commonjs')
The method in which unbundled modules will be required in the code. Best to leave as commonjs
for node modules.
May be one of documented options or function callback(moduleName)
which returns custom code to be returned as import type, e.g:
options.importType = function(moduleName) {
return "amd " + moduleName;
};
var awsExternals = require('webpack-aws-externals');
...
module.exports = {
...
target: 'node', // important in order not to bundle built-in modules like path, fs, etc.
externals: [awsExternals({
// this WILL include `uuid` in the bundle
whitelist: ['uuid']
})],
...
};
For most use cases, the defaults of importType
should be used.
Contributions and pull requests are welcome.
MIT
@liady made an awesome package that let us make this very quickly.
FAQs
Easily exclude node_modules provided by AWS Lambda in Webpack bundle
The npm package webpack-aws-externals receives a total of 490 weekly downloads. As such, webpack-aws-externals popularity was classified as not popular.
We found that webpack-aws-externals demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.