Skip to content

Match sourceMaps by sourceMappingURL #1997

@Marmiz

Description

@Marmiz

Feature request description

Looking at the current implementation of sourcemap commands, it seems that the command is trying to match the js with the map file by name.

However it seems not all bundler will respect that, and instead suggest to use the sourceMappingURL comment at the end of each file.

For instance, Nextjs and its default Turbopack bundler seems to suggest that matching file name is not a given, and they won't fix it, as highlighted here.

In this case when building with webpack the output is as follow:

hashedFile.js
hasehdFile.js.map
// at the bottom of hashedFile.js
//# sourceMappingURL=hashedFile.js.map

While with Turbopack

hashedFile.js
differentHashed.js.map
// at the bottom of hashedFile.js
//# sourceMappingURL=differentHashed.js.map

(hope it make sense)

Solution

The sourcemap upload command respect the //# sourceMappingURL linking in the minified file when uploading sourceMaps.

Additional context

I understand that this is a pure bundler difference, but seeing how popular NextJS is, and its move towards Turbopack as a default with its latest version, is something worth considering it.

Command

sourcemaps

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestrumRelated to [dsyms, flutter-symbols, react-native, sourcemaps, unity-symbols]

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions