aws-amplify / amplify-backend

Home to all tools related to Amplify's code-first DX (Gen 2) for building fullstack apps on AWS
Apache License 2.0
142 stars 45 forks source link

Custom esbuild bundling options for esbuild #1688

Open ErlendHer opened 2 weeks ago

ErlendHer commented 2 weeks ago

Environment information

-

Description

We want to be able to modify the "bundling" property of the NodejsFunction CDK definition so that we can customize how the lambda function is bundled.

Our use case is that we want to generate source maps to upload to sentry after a deployment during the pipeline

josefaidt commented 2 weeks ago

Hey @ErlendHer :wave: thanks for raising this! We were discussing whether to enable sourcemaps by default. Is there a particular workflow you follow to upload these to Sentry? Is this something that is read from the built assets?

ErlendHer commented 2 weeks ago

Hey @ErlendHer 👋 thanks for raising this! We were discussing whether to enable sourcemaps by default. Is there a particular workflow you follow to upload these to Sentry? Is this something that is read from the built assets?

It depends, one can use the esbuild plugin which automatically handles it, it is also possible to upload the sourcemaps directly if using the plugin is not an option. Using the plugin would of course be the easiest in this case.

https://docs.sentry.io/platforms/javascript/guides/aws-lambda/sourcemaps/uploading/esbuild/