-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
feat(bundler): Add --sourcemap=linked
for //# sourceMappingURL
comments
#11983
Conversation
❌ @paperdave, your commit has failing tests :( 💪 1 failing tests Darwin AARCH64
🐧🖥 1 failing tests Linux x64
🪟💻 4 failing tests Windows x64 baseline
🪟💻 1 failing tests Windows x64
|
src/bundler/bundle_v2.zig
Outdated
@@ -9336,12 +9336,27 @@ const LinkerContext = struct { | |||
); | |||
|
|||
switch (c.options.source_maps) { | |||
.external => { | |||
inline .external, .linked => |tag| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need the inline
?
inline .external, .linked => |tag| { | |
.external, .linked => |tag| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this makes tag
comptime, which is what it is being used in the if
. i guess that isn't strictly needed for this use-case. i can remove.
src/bundler/bundle_v2.zig
Outdated
@@ -9520,13 +9535,26 @@ const LinkerContext = struct { | |||
); | |||
|
|||
switch (c.options.source_maps) { | |||
.external => { | |||
inline .external, .linked => |tag| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need the inline
?
inline .external, .linked => |tag| { | |
.external, .linked => |tag| { |
What about |
We're probably also going to want to allow a different base url as an option for sourcemaps, like |
IMO, the behavior should be:
|
ah, yeah that should be handled. i overlooked that.
that makes sense, but i would recommend for cases like this to use
Ok. It will be a bit extra to document but we can do that. I was hesitant to change defaults much. I think this will "just work" for most people, but it does feel a bit odd to have it vary in this way (i like what esbuild does, but that would be a breaking api change for us). |
I don't think that is necessary, since esbuild doesn't have this. We maybe want to add |
What does this PR do?
This implements --sourcemap=linked exactly as esbuild does so.
This also changes the default behavior of --sourcemap to linkednvm, it was inline and will stay inline. When using external sourcemaps, it is almost always a better idea to use linked sourcemaps, as that is what browsers and most tooling supports. Having unlinked external sourcemaps (--sourcemap=external
) can be useful for proprietary codebases where the source map and the bundled code are meant to be isolated.For more context, see https://esbuild.github.io/api/#sourcemap
also fixes this disabled test because some of these chars are hex lowercase which is silly.
Fixes #3325
Fixes #9314