microsoft / microsoft/TypeScript

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

Offen
#26,531 3 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

In Discussion Suggestion
Vorherrschende Sprache
Go
Sterne
111k
Forks
14.3k
Ø Merge
2 T. 4 Std.
Gemergte PRs (30 T.)
132

Beschreibung

Previous related issue: https://github.com/Microsoft/TypeScript/issues/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"
  ]
}

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginnen Sie mit der Prüfung des zugehörigen Issues und der gemeldeten tsconfig-Beispiele. Verfolgen Sie anschließend, wie TypeScript Source Maps ausgibt und mapRoot und sourceRoot auflöst. Als abgeschlossen gilt die Arbeit, wenn eine Option das Verhalten von TypeScript 2.9.2 mit absoluten Pfaden für den gemeldeten UWP-Debugging-Fall reproduzieren kann und eine Abdeckung für die relevante Source-Map-Ausgabe vorhanden ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript, typescript
Bereich
compilers, tooling
Issue-Typ
Feature
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.