{"id":24948,"library":"aws-lambda-nodejs-esbuild","title":"aws-lambda-nodejs-esbuild","description":"AWS CDK Construct for bundling Node.js AWS Lambda functions using esbuild. Version 1.1.6 (latest) supports zero-config bundling with ESNext/TypeScript, automatic package manager detection, and external module support. Unlike @aws-cdk/aws-lambda-nodejs (which uses esbuild internally but with less configurability), this construct exposes full esbuild options and allows overriding the 'exclude' list. Currently in maintenance mode; designed for CDK v1 and lacks native CDK v2 support.","status":"maintenance","version":"1.1.6","language":"javascript","source_language":"en","source_url":"https://github.com/floydspace/aws-lambda-nodejs-esbuild","tags":["javascript","aws-cdk","cdk-construct","construct","esbuild","aws-lambda","aws-lambda-node","aws","lambda","typescript"],"install":[{"cmd":"npm install aws-lambda-nodejs-esbuild","lang":"bash","label":"npm"},{"cmd":"yarn add aws-lambda-nodejs-esbuild","lang":"bash","label":"yarn"},{"cmd":"pnpm add aws-lambda-nodejs-esbuild","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Bundling Lambda code; must be installed separately in the project","package":"esbuild","optional":true},{"reason":"CDK Lambda construct base class; peer dependency","package":"@aws-cdk/aws-lambda","optional":false},{"reason":"CDK core library for stack and construct definitions; peer dependency","package":"@aws-cdk/core","optional":false}],"imports":[{"note":"Package ships TypeScript types; ESM import is preferred but CJS require works in Node.js","wrong":"const { NodejsFunction } = require('aws-lambda-nodejs-esbuild')","symbol":"NodejsFunction","correct":"import { NodejsFunction } from 'aws-lambda-nodejs-esbuild'"},{"note":"Type export for TypeScript users; use to type the props object","wrong":"","symbol":"NodejsFunctionProps","correct":"import { NodejsFunctionProps } from 'aws-lambda-nodejs-esbuild'"},{"note":"No default export; must use named import","wrong":"import AWS from 'aws-lambda-nodejs-esbuild'","symbol":"default","correct":"import AWS from 'aws-lambda-nodejs-esbuild'"}],"quickstart":{"code":"import * as cdk from '@aws-cdk/core';\nimport { NodejsFunction } from 'aws-lambda-nodejs-esbuild';\nimport { Runtime } from '@aws-cdk/aws-lambda';\n\nclass MyStack extends cdk.Stack {\n  constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {\n    super(scope, id, props);\n\n    new NodejsFunction(this, 'MyLambda', {\n      entry: 'src/handler.ts',\n      runtime: Runtime.NODEJS_14_X,\n      esbuildOptions: {\n        minify: true,\n        target: 'ES2017',\n        external: ['aws-sdk'],\n      },\n    });\n  }\n}\n\nconst app = new cdk.App();\nnew MyStack(app, 'MyStack');","lang":"typescript","description":"Creates a CDK stack with a Lambda function bundled using esbuild, with minification and external aws-sdk."},"warnings":[{"fix":"For CDK v2, use @aws-cdk/aws-lambda-nodejs built-in bundling or migrate to a CDK v2 compatible construct","message":"Package is designed for AWS CDK v1 and not updated for CDK v2","severity":"deprecated","affected_versions":">=1.0.0 <=1.1.6"},{"fix":"Run 'npm install --save-dev esbuild' or 'yarn add --dev esbuild'","message":"esbuild must be installed separately in the project; not a dependency of this package","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Add additional modules to esbuildOptions.external: e.g., external: ['aws-sdk', 'pg-native']","message":"The default 'exclude' option only excludes 'aws-sdk'; other large dependencies must be manually externalized","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Explicitly set runtime property on NodejsFunction to avoid reliance on default","message":"Version 1.1.6 changed default runtime to match CDK Lambda defaults; may affect previously working builds","severity":"breaking","affected_versions":"1.1.6"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"npm install --save-dev esbuild","cause":"esbuild is not installed in the project","error":"Error: Cannot find module 'esbuild'"},{"fix":"npm install --save @aws-cdk/aws-lambda @aws-cdk/core","cause":"CDK peer dependencies not installed","error":"Error: Cannot find module '@aws-cdk/aws-lambda'"},{"fix":"Add 'entry' to the props: entry: 'src/index.ts'","cause":"The 'entry' property is required for NodejsFunction but omitted","error":"Property 'entry' is missing in type 'NodejsFunctionProps'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}