Painless hot-reload and debug locally with Serverless Framework, TypeScript, and Esbuild.
Usually you would build your own stack for developing with Serverless Framework and Typescript, but you would find some challenges until achieve a fully functional project that supports local hot-deploy and able to debug, so I created this project.
Seriously, that debugging screen is all you want:
All challenges found you may check this article I made for Serverless Guru Blog about this project.
- Serverless Framework 3.0
- Serverless Esbuild
- Serverless Offline
- Typescript
- Eslint
- Simple and low configuration TypeScript project
- Ready for debugging locally
- Ready for hot-reload locally
- Run locally directly from TypeScript
- VS Code configuration ready for debugging with serverless-offline
- Hot deploy: make changes to your Lambda handler and get instant effect without restarting local server
- Generates sourcemaps for AWS Lambda better error handling
- Transpiles into minified JavaScript and removes dead code from imports
- Sourcemaps Node flag for Lambda error handling in TypeScript
- Doesn't need separate
npm run build
command,sls package
andsls deploy
already triggers a hook for transpiling into JavaScript
Install dependencies:
npm install
Run lambda locally:
npm run dev
Auto linter fix:
npm run lint
Runs tsc
for type-checking (esbuild doesn't do type-checking):
npm run check
Runs linter, type-checking and package everything (it already runs esbuild transpiling) and deploys dev
stage to us-east-1
:
npm run deploy
Debug locally with VS Code:
Check my article on Serverless Guru Blog I made for this template and feel free to call me on LinkedIn.
Enjoy Serverless Framework! Enjoy TypeScript! 😃