Skip to content

Broken sourcemaps #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jimrandomh opened this issue Jan 14, 2021 · 2 comments
Closed

Broken sourcemaps #28

jimrandomh opened this issue Jan 14, 2021 · 2 comments

Comments

@jimrandomh
Copy link

After each build, patchSourceMap modifies the source-maps esbuild emitted, deleting the sourcesContent field and setting sourceRoot to a relative path from the output directory to the working directory. In practice, if the output file is a webap, this breaks source mapping; the relative path doesn't point anywhere sensible when it's treated as a UR. Commenting out the call to patchSourceMap fixes it, as does using sourcemap:"inline" (but the latter drastically increases the size of the output javascript bundle).

jimrandomh added a commit to ForumMagnum/ForumMagnum that referenced this issue Jan 14, 2021
See rsms/estrella#28 . We were working around
this by passing `sourcemap: "inline"` but doing that is very bad (it
makes the bundle much much larger). Instead, use a forked version which
removes Estrella's broken attempt at transforming sourcemaps.
@rsms
Copy link
Owner

rsms commented Mar 11, 2021

I've dug into it and it seems esbuild now generates "good" sourcemaps. I'm removing the patching code with one exception: When you generate a sourcemap but no output javascript, the paths of the sources themselves need to be patched no matter what. (there's a test for this at test/tempfile-output)

With the changes I'm about to land, you can now ask for sourcesContent by providing the (esbuild-inherited) option sourcesContent like so:

build({
  sourcemap: true, // or inline or filename
  sourcesContent: true,
})

This will cause esbuild to include sourcesContent in your sourcemap

@rsms rsms closed this as completed in fe78bf2 Mar 11, 2021
@rsms
Copy link
Owner

rsms commented Mar 12, 2021

Shipped with release 1.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants