shlogg · Early preview
Jochen @jochen36

Overcoming CDK Decorator Issues In Node.js Lambda Functions

Working with CDK's Node.js Lambda Function Construct: esbuild lacks support for decorators, causing errors. Use pre-compilation with TypeScript or a custom build script with esbuild-plugin-tsc to resolve issues in Nx monorepos.

Working with CDK's Node.js Lambda Function Construct

The AWS CDK provides a convenient construct for Node.js Lambda functions.

  
  
  What is the NodejsFunction Construct?

According to the documentation:

The NodejsFunction construct creates a Lambda function with automatic transpiling and bundling of TypeScript or JavaScript code. This results in smaller Lambda packages that contain only the code and dependencies needed to run the function.

To perform this transpiling and bundling, it relies on esbuild.


  
  
  Issue: Esbuild Lacks Support for Decorators

Unfortunately, esbuild does no...