Skip to content

Resolving sources for inlined (data URI) sourcemaps #213

@sapphi-red

Description

@sapphi-red

The current text describes that relative sources are resolved from the source map.

If the sources are not absolute URLs after prepending the sourceRoot, the sources are resolved relative to the source map (like resolving the script src attribute in an HTML document).
https://tc39.es/ecma426/#sec-sources

If the sourcemap is a data URI, IIUC relative paths cannot be resolved (e.g. new URL("./foo", "data:text/plain,foo") throws an error). So I think this description is not correct.

In this case, all tools I know resolves the sources from the URL of the file that contains the sourceMappingURL annotation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions