Skip to content

Instantly share code, notes, and snippets.

@michaelwittig
Created October 11, 2023 07:47
Show Gist options
  • Save michaelwittig/ed07182f28728c9ccfc05540d89c24b3 to your computer and use it in GitHub Desktop.
Save michaelwittig/ed07182f28728c9ccfc05540d89c24b3 to your computer and use it in GitHub Desktop.
Build code for inline CloudFormation Lambda functions (can be used with CDK)
function zipFile(lambdaFile) {
return esbuild.buildSync({
entryPoints: [`lambda/${lambdaFile}`], // your path might be different
external: ['@aws-sdk/*'],
target: ['node18'],
platform: 'node',
bundle: true,
write: false,
treeShaking: true
}).outputFiles[0].text;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment