aws / aws/aws-sam-cli

Feature request: Do not force --enable-source-maps output in build.

Open
#6,021 2 comments 0 reactions 0 assignees View on GitHub
type/feature
Dominant language
Python
Stars
6.7k
Forks
1.2k
Avg merge
1d 10h
Merged PRs (30d)
52

Description

### Describe your idea/feature/enhancement

When creating a TypeScript Lambda function,
I would like to avoid forcing the "--enable-source-maps" output of the "Sourcemap: true" standard.

The purpose is to use [source-map-support](https://github.com/evanw/node-source-map-support) as a result of the following performance measurements.
https://github.com/cspotcode/source-map-performance-demo

### Proposal

Proposal1. make the output of "NODE_OPTIONS: '--enable-source-maps'" optional if "Sourcemap: true" is specified
Proposal2. add a parameter to disable "NODE_OPTIONS: ' --enable-source-maps

**Proposal1 example**

This one will change the current behavior.

```yaml
Metadata:
BuildMethod: esbuild
BuildProperties:
Sourcemap: true
EnableSourceMap: true # This one
```

**Proposal2 example**

This does not change the current default behavior of outputting "NODE_OPTIONS: '--enable-source-maps'".

```yaml
Metadata:
BuildMethod: esbuild
BuildProperties:
Sourcemap: true
DisableEnableSourcemap: true # This one
```

### Additional Details

We get the following options

- [Current] Sourcemap: If false, *.js.map is not output and NODE_OPTIONS: ' --enable-source-maps' is not output
- [Current] Sourcemap: if true, *.js.map is output and NODE_OPTIONS: ' --enable-source-maps
- [This issue idea]Sourcemap: if true, *.js.map is output and NODE_OPTIONS: ' --enable-source-maps' is not output
- Once this method is added, third-party libraries (e.g., source-map-support) can be used to handle source maps.

The --enable-source-maps slow issue seems to be resolved in Node 19 from the reference link above, but the current LTS is Node 18. I think it is a good idea to address this in SAM rather than wait for Node 20 to be supported in AWS Lambda We think it is a good idea to support SAM rather than waiting for Node 20 to be supported by AWS Lambda. Also important is the option to use third party libraries.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.