lambda-packer

Build and pack a lambda functions written in ES-whatever

Usage no npm install needed!

<script type="module">
  import lambdaPacker from 'https://cdn.skypack.dev/lambda-packer';
</script>

README

AWS Lambda Packer

This function builds a list of all the dependents of a function using webpack and its node packer and creates a package with only the required files to run in Lambda.

Especially useful when you want to use babel / ES6 features and not have to worry about them running on lambda's ancient node version (v0.10)

Useage

// in a gulpfile / task runner / whatever
import lambdaPacker from 'lambda-packer';

function deployToLambda() {
  const options {
    zip: true, // set to true to pack a zip file for sending to AWS
    functionsDir: './src/functions'
  };

  lambdaPacker(options).then(zipBuffer =>
    // send to AWS using `aws-sdk`
    // see the AWS docs for details on that
    sendToLambda(zipBuffer)
  );
}