镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

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

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 Igor Minar (@IgorMinar)

Activity

  1. mhegazy commented on Jun 7, 2016

    @mhegazy
    Contributor

    Sheetal Nandi (@sheetalkamat) can you take a look.

  2. added a commit that references this issue on Jun 9, 2016
    b521fd5
  3. added 2 commits that reference this issue on Jun 14, 2016
    f235bf7
    171ab06
  4. locked and limited conversation to collaborators on Jun 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issue

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions