When packaging a typescript lambda I get my dev dependencies included


Id like to use TypeScript instead of nodejs. But whenever I package I get my dev dependencies included. I had this working for nodejs but when I package with typescript it doesnt work.

Does anyone else have this working?

After googling for some time I found this page.

In the webpack.config.js
you have to add this.
externals: [
‘aws-sdk’ // aws-sdk included in Lambda

Now I get some warnings when running serverless package
[2] external “aws-sdk” 42 bytes {0} {1} {2} {3} {4} [not cacheable]

But aws-sdk is no longer included and it works on aws.

I understand why its not included in the template when I run

serverless create --template aws-nodejs-typescript --path myService

since its not needed because the template doesnt depend on any aws stuff. But it would be nice if it could be added as documentation in the webpack config file.