Closed Grmiade closed 6 months ago
BTW I found a workaround by setting the SourcesContent
property to 'false'
(as a string).
Hi @Grmiade, thanks for reporting this issue. Using the string form here is actually expected since this is part of the 'single value` esbuild API as defined in their documentation https://esbuild.github.io/api/ and how it's used here https://esbuild.github.io/api/#sources-content
@mildaniel So we should probably update the documentation https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-using-build-typescript.html#serverless-sam-cli-using-build-typescript-example. What do you think?
Thanks for pointing this out and you're absolutely right, we should update those docs.
Documentation updates have been made, resolving.
Description:
When we configure
BuildProperties.SourcesContent
tofalse
, the setting has no effect on the generated bundle. See this documentation: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-using-build-typescript.html#serverless-sam-cli-using-build-typescript-exampleSteps to reproduce:
Set
BuildProperties.Sourcemap
to true andBuildProperties.SourcesContent
tofalse
. ThesourcesContent
field is visible on the generated source map.Observed result:
IMO The issue is coming from this function: https://github.com/aws/aws-lambda-builders/blob/d21f0d501a6903065bc426ff1cd97e2f6234ddce/aws_lambda_builders/workflows/nodejs_npm_esbuild/esbuild.py#L182-L196 Since
SourcesContent
is enabled by default, we need to set the option tofalse
to disable it, but the code ignores the boolean options when they are set tofalse
.Expected result:
The
sourcesContent
field should not be visible on the generated source map.Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
sam --version
: 1.106.0