Improve source maps, when using plugins for resolving imports
- Dominant language
- Go
- Stars
- 40.1k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Description
I'm using [esbuild_deno_loader](https://github.com/lucacasonato/esbuild_deno_loader) plugin with es builder to bundle my code (I'm developing for the web, and using deno instead of node.js)
Everything works fine, except for the sourcemaps, as the sources section contains the resolved paths together with the namespace provided by the deno_loader plugin.
The plugin resolves both local files and remote http/https modules in the deno namespace.
Here are some examples:
```json
{
"version": 3,
"sources":
[ "deno:file:///C:/work/travelmate/src/map/placeData.ts",
"deno:file:///C:/work/travelmate/libs/dmsg/ts/src/lib/location/distance.ts",
"deno:https://raw.githubusercontent.com/bxantus/xdom/v0.9.2/src/dispose.ts"
]
```
Reading the plugin development guide, this is what it should do, but I think esbuild shouldn't prepend source paths with the namespace inside source maps.
In my opinion the namespace is something different than the URI protocol, so I think we should rely here on the paths returned from the plugin.
I successfully patched the plugin locally, so it resolved local files inside the `file` namespace, but I feel this should be addressed rather here in esbuild.
Let me know what you think, also @lucacasonato what's your opinion about this?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the issue with esbuild_deno_loader and inspect the generated source map's sources entries for local and remote modules. Read the plugin development guide and compare the current namespace handling with the paths returned by the plugin; done means source maps represent those paths without the unwanted deno namespace prefix.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, typescript
- Domain
- build-system, compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100