Feature request: Build sourcemaps without setting `NODE_OPTS: '--enable-source-maps'`
- Dominant language
- Python
- Stars
- 6.7k
- Forks
- 1.2k
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 52
Description
### Describe your idea/feature/enhancement
I'd like esbuild to create sourcemaps and include them in the lambda zip file, but I don't want to set the `--enable-source-maps` node option. Node's built-in source map support has major performance implications, as mentioned in your documentation.
Turning them off entirely isn't ideal, however, as I'd like to 1. upload source maps to Sentry during my deploy process and 2. use [source-map-support](https://www.npmjs.com/package/source-map-support) to handle, which is _way_ faster than Node's built-in support.
### Proposal
Add additional options to the esbuild metadata to separate building sourcemaps from enabling sourcemaps. I can imagine something like
```
BuildSourcemap: boolean
EnableSourcemap: boolean
```
In order to maintain backwards compatibility, `Sourcemap: true` would imply `BuildSourcemap: true` and `EnableSourcemap: true`.
Alternatively, the `Sourcemap` option could be updated to something like:
```
Sourcemap: boolean | 'build' | 'enable'
```
Where `Sourcemap: true` implies `Sourcemap: 'enable'`.
I could also imagine, at some point, providing an option for controlling _how_ to enable sourcemaps. It could be left up to the consumer whether sourcemaps are enabled using `--enable-source-maps` or `--require source-map-support/register`.
Contributor guide
Assessment
This issue has not been assessed yet.