An esbuild plugin (v1.1.2, active development) that automatically configures bundling for AWS CloudFront Functions, supporting both v1 (ES5.1+) and v2 (ES2020+) runtimes. It sets the correct esbuild target, format (ES modules), and enables/disables features per runtime constraints. Requires Node >=18 and esbuild >=0.14.46. Differentiators: handles edge-case runtime polyfills and feature toggling that manual configs often miss, and outputs minimal ESM-compatible bundles.
npm install esbuild-cf-functions-pluginNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Build a CloudFront Function-compatible bundle from src/index.js using default v1 runtime.
Upgrade Node.js to >=18 or pin to v0.2.x
Update esbuild to >=0.14.46
Rely on plugin to set these correctly; do not specify format/target in esbuild config
Ensure CloudFront Functions runtime supports ES modules (v2) or adapt code accordingly
Pass { runtimeVersion: 2 } to CloudFrontFunctionsPlugin for ES2020+ featuresnpm install -D esbuild-cf-functions-plugin
Ensure you invoke the factory: plugins: [CloudFrontFunctionsPlugin()]
Remove target from esbuild config; plugin sets correct value