Skip to content

Absolute root source map path causes issue on Windows. #263

Description

@dragomirtitian

When the sourceRoot field of a source map is a URL to an absolute windows path, the source files are not correctly loaded.

Example:

{"version":3,"sources":["client/main.t.ts"], "mappings":"...","file":"main.t.js","sourceRoot":"file:///Z:\\project\\library"}

When resolving the sourceRoot, there is a naive replacing of 'file://' with '' instead of calling fileURLToPath which would correctly handle the windows root path. So we end up with the invalid path /Z:\project\library

sourcePath = sourcePath.replace(/^webpack:\/\//, '')
const sourceRoot = rawSourceMap.sourcemap.sourceRoot ? rawSourceMap.sourcemap.sourceRoot.replace('file://', '') : ''
const candidatePath = join(sourceRoot, sourcePath)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions