Build all Node.js lambdas with the same esbuild configuration.
esbuild-config.yaml for ESM
Bundle: trueFormat: esmOutExtension: - .js=.mjsSourcemap: trueTarget: node20External: - '@aws-sdk/*'Define: - require.resolve=undefinedBanner: - | js=import { createRequire } from 'node:module' import { dirname } from 'node:path' import { fileURLToPath } from 'node:url' const require = createRequire(import.meta.url) const __filename = fileURLToPath(import.meta.url) const __dirname = dirname(__filename)Platform: node``````yamlMetadata: expand: plugins: - '@starterstack/sam-expand/plugins/esbuild-node' config: esbuild: config: ./esbuild-config.yaml Copy
Bundle: trueFormat: esmOutExtension: - .js=.mjsSourcemap: trueTarget: node20External: - '@aws-sdk/*'Define: - require.resolve=undefinedBanner: - | js=import { createRequire } from 'node:module' import { dirname } from 'node:path' import { fileURLToPath } from 'node:url' const require = createRequire(import.meta.url) const __filename = fileURLToPath(import.meta.url) const __dirname = dirname(__filename)Platform: node``````yamlMetadata: expand: plugins: - '@starterstack/sam-expand/plugins/esbuild-node' config: esbuild: config: ./esbuild-config.yaml
Remarks
Build all Node.js lambdas with the same esbuild configuration.
Example
esbuild-config.yaml for ESM