Use Webpack to write AWS Lambda Functions in ES6

Published on September 8th, 2019

serverless icon

ES6 is fun! And you should use it, but you can’t write ES6 and ES modules out of box in Lambda Functions. We will need help from Serverless Framework and few of its plugins.

Make sure that you npm/yarn initialized your repository and then install these packages.

yarn add -D serverless-bundle

And another thing you have to do is add these two lines to serverless.yml.

  - serverless-bundle

Now you can use stuff like export default and import x from 'x' in your function handlers.