Skip to content

Add an option to force source maps to use absolute paths? #26531

Open
@saschanaz

Description

@saschanaz

Previous related issue: #23180

It seems VS2017 is incompatible with relative paths, when debugging a UWP app now tries to load source maps from the app URI and the host does not support it.

'WWAHost.exe' (Script): Loaded 'Script Code (MSAppHost/3.0)'. 
SourceMap ms-appx://6b826582-e42b-45b9-b4e6-dd210285d94b/js/require-config.js.map read failed: The URI prefix is not recognized..

Hard-coding the full path in tsconfig.json is not a good idea here, I hope we have an option to behave as 2.9.2 so that we can get the auto-resolved full path.

Edit: My tsconfig.json that works in TS2.9 but not in TS3.0:

{
  "compilerOptions": {
    "strict": true,
    "noEmitOnError": true,
    "removeComments": false,
    "sourceMap": true,
    "target": "es2017",
    "outDir": "js/",
    "mapRoot": "js/",
    "sourceRoot": "sources/",
    "emitBOM": true,
    "module": "amd",
    "moduleResolution": "node"
  },
  "exclude": [
    "node_modules",
    "wwwroot"
  ]
}

My failed trial to fix this: (removed mapRoot and changed sourceRoot)

{
  "compilerOptions": {
    "strict": true,
    "noEmitOnError": true,
    "removeComments": false,
    "sourceMap": true,
    "target": "es2017",
    "outDir": "js/",
    "sourceRoot": "../sources/",
    "emitBOM": true,
    "module": "amd",
    "moduleResolution": "node"
  },
  "exclude": [
    "node_modules",
    "wwwroot"
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Add a FlagAny problem can be solved by flags, except for the problem of having too many flagsIn DiscussionNot yet reached consensusSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions