You can now use TypeScript in your Lambda functions by simply including the serverless-bundle plugin.

serverless-bundle plugin npm screenshot

The serverless-bundle plugin optimally packages your Node.js Lambda functions with sensible defaults so you don’t have to maintain your own Webpack configs. Thanks to a community-wide effort, serverless-bundle now supports TypeScript as well!

To use the new version of serverless-bundle, install the NPM package.

$ npm install --save-dev --save-exact serverless-bundle@2.0.0

Add it to your serverless.yml.

plugins:
  - serverless-bundle

And to run your tests, update your package.json with:

"scripts": {
  "test": "serverless-bundle test"
}

If you have a tsconfig.json, serverless-bundle will automatically compile your TypeScript files. If you need to specify it by name, add the following to your serverless.yml.

custom:
  bundle:
    tsConfig: 'tsconfig.special.json'

For a full list of options, make sure to check out our README.

So give serverless-bundle a try in your projects, and make sure to star it on GitHub! ⭐