lambundaler

raw JSON →
0.11.1 verified Sat Apr 25 auth: no javascript maintenance

A bundler for AWS Lambda functions that browserifies and zips code for deployment. Current stable version is 0.11.1, released with dependency updates addressing a high-severity lodash vulnerability. The package has a slow release cadence (last release in 2018). It differs from other AWS Lambda bundlers by integrating Browserify for bundling and providing options for minification, source maps, native addon compatibility, and optional deployment via the AWS SDK. Supports Node.js >=4.0.0.

error Cannot find module 'browserify'
cause browserify not installed
fix
Run 'npm install browserify --save-dev'.
error Error: ENOENT: no such file or directory
cause Entry file path incorrect
fix
Provide absolute path or relative path from project root.
error TypeError: Lambundaler is not a function
cause Importing from ESM style
fix
Use 'const Lambundaler = require("lambundaler")'.
deprecated lodash dependency may have security vulnerabilities.
fix Update to version 0.11.1 or later.
breaking Callback signature changed: now provides buffer and artifacts.
fix Update callback to accept (err, buffer, artifacts).
gotcha The 'aws-sdk' module is excluded by default when bundling; if needed, include via 'files' option.
fix Add 'aws-sdk' to 'files' array if required.
npm install lambundaler
yarn add lambundaler
pnpm add lambundaler

Shows basic usage: bundle a lambda handler, minify, exclude aws-sdk, and write to zip.

const Lambundaler = require('lambundaler');

Lambundaler({
  entry: 'lambda.js',
  export: 'handler',
  output: 'lambda.zip',
  minify: true,
  exclude: ['aws-sdk']
}, (err, buffer, artifacts) => {
  if (err) {
    console.error(err);
    return;
  }
  console.log('Bundle written to lambda.zip');
});