Skip to content

sourcemap file contains relative path calculated from parent of outDir and basePath #8445

@alexeagle

Description

@alexeagle

Hi from ng-conf! :)

TS nightly.

alexeagle-macbookpro2:repro_sourceMap alexeagle$ cat some/path/to/src/myfile.ts
export let a:string;
alexeagle-macbookpro2:repro_sourceMap alexeagle$ cat some/path/to/src/tsconfig.json
{
    "compilerOptions": {
        "module": "commonjs",
        "target": "es5",
        "noImplicitAny": false,
        "sourceMap": true,
        "inlineSources": true,
        "outDir": "../../../../dist"

    },
    "exclude": [
        "node_modules"
    ]
}
$ cat dist/myfile.js.map
{"version":3,"file":"myfile.js","sourceRoot":"","sources":["../some/path/to/src/myfile.ts"],"names":[],"mappings":";AAAoB","sourcesContent":["export let a:string;"]}

the sourceMap contains my private bits "some/path/to/" which we would like it not to.
This causes devTools in the browser to show a strange path that confuses users.

screen shot 2016-05-03 at 12 52 03 pm

The obvious way to fix this would be the sourceRoot option in tsconfig.json which we could set to .. but this is not allowed:

error TS5053: Option 'sourceRoot' cannot be specified with option 'inlineSources'.

Proposal is that sourceRoot should be allowed with inlineSources. The resulting .js.map file would contain a path that doesn't resolve locally on disk, but does work at runtime. (it's similar to the pathMapping feature where design-time filesystem layout does not need to match runtime)

cc @IgorMinar

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issue

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions