empty output cause sources && sourcesContent missing in sourcemap
- Dominant language
- Go
- Stars
- 40.1k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Description
esbuild version: 0.14.1
when run the following command
```sh
$ esbuild src/index.js --bundle --format=esm --outfile=dist/bundle.js --sourcemap
```
* src/index.js
```ts
function add(a,b){
return a+b;
}
```
generates the following sourcemap
```json
{
"version": 3,
"sources": [],
"sourcesContent": [],
"mappings": "",
"names": []
}
```
when input content change to
```ts
//src/index.js
function add(a,b){
return a+b;
}
console.log(add);
```
it generates
```json
{
"version": 3,
"sources": ["../src/index.js"],
"sourcesContent": ["function add(a,b){\n return a+b;\n}\nconsole.log('add:',add)"],
"mappings": ";AAAA,aAAa,GAAE,GAAE;AACf,SAAO,IAAE;AAAA;AAEX,QAAQ,IAAI,QAAO;",
"names": []
}
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the command from the issue with src/index.js in both forms and inspecting the generated sourcemap. Trace why the input containing only the add function produces empty sources and sourcesContent, then verify that the sourcemap retains the expected source information without the extra console.log call.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, javascript
- Domain
- build-system, compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100