Skip to content

TS 3.0 generates invalid path for sourceMappingURL #26530

@saschanaz

Description

@saschanaz

TypeScript Version: 3.0.1

Search Terms: sourceroot, maproot, sourceMappingURL

Code

// tsconfig.json
{
  "compilerOptions": {
    "sourceMap": true,
    "outDir": "js/",
    "mapRoot": "js/",
    "sourceRoot": "sources/"
  }
}

// sources/index.ts
"Hello world!";

Expected behavior: It should generate a valid path.

Actual behavior:

"Hello world!";
//# sourceMappingURL=../sources/js/index.js.map

Related Issues: I think #23989 caused this, as 2.9.2 generates a valid (but absolute) path:

"Hello world!";
//# sourceMappingURL=(absolute path)/js/index.js.map

Workaround?: Modifying tsconfig seems to be generate valid paths, but then VS2017 (15.8.1) fail to map the file.

{
  "compilerOptions": {
    "sourceMap": true,
    "outDir": "js/",
    "sourceRoot": "../sources/"
  }
}
"Hello world!";
//# sourceMappingURL=index.js.map
{"version":3,"file":"index.js","sourceRoot":"../sources/","sources":["index.ts"],"names":[],"mappings":"AAAA,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,CAA

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    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