microsoft / microsoft/TypeScript

Provide option to not include `sourceMappingURL` in the generated `.js` file when `sourceMap` is `true`

Offen
#59,896 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Awaiting More Feedback Suggestion
Vorherrschende Sprache
Go
Sterne
111k
Forks
14.3k
Ø Merge
1 T. 19 Std.
Gemergte PRs (30 T.)
117

Beschreibung

🔍 Search Terms
  • sourceMappingURL
  • sourceMap
✅ Viability Checklist
⭐ Suggestion

There should be a compilerOption to disable inclusion of sourceMappingURL in the generated .js file when sourceMap is true.

📃 Motivating Example

When sourceMap is true in tsconfig.json, TypeScript compiler generates .map file together with .js file and also include sourceMappingURL in .js file.

The inclusion of sourceMappingURL in .js file is one way of linking generated code with sourcemap.
Another way is to use SourceMap header.

Right now, to make use of SourceMap header without including sourceMappingURL in .js file, I have to:

  1. set sourceMap to true
  2. run npx tsc
  3. set sourceMap to false
  4. run npx tsc once again.

There should provide a compilerOption to disable inclusion of sourceMappingURL in the generated .js file.

💻 Use Cases
  1. What do you want to use this for?
    I want to use this to use SourceMap header without getting warning in browser. The benefit of using SourceMap header is that the linking of generated file to map file can be controlled by the server without regenerating .js file.

  2. What shortcomings exist with current approaches?
    sourceMappingURL is included in .js file.

  3. What workarounds are you using in the meantime?

    1. set sourceMap to true
    2. run npx tsc
    3. set sourceMap to false
    4. run npx tsc once again.

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

In der Issue werden keine Dateien, Tests oder Compiler-Einstiegspunkte genannt. Beginne damit nachzuverfolgen, wie die Compiler-Option sourceMap die Ausgabe von .map-Dateien und den Kommentar sourceMappingURL steuert. Erledigt ist die Aufgabe, wenn eine dokumentierte Compiler-Option diesen Kommentar unterdrücken kann und weiterhin Source Maps ausgegeben werden, mit Abdeckung sowohl des aktivierten als auch des deaktivierten Verhaltens.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript, typescript
Bereich
compilers
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
30/100

Neue Issues direkt in Ihr Postfach

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