microsoft / microsoft/TypeScript

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

オープン
#59,896 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Awaiting More Feedback Suggestion
主要言語
Go
スター
111k
フォーク
14.3k
平均マージ
1日 19時間
マージ済み PR(30日)
117

説明

🔍 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.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

issue ではファイル、テスト、またはコンパイラのエントリポイントが指定されていません。まず、コンパイラオプション sourceMap.map の出力と sourceMappingURL コメントをどのように制御しているかを追跡してください。文書化されたコンパイラオプションによってそのコメントを抑制しつつ source map の出力を継続でき、 有効時と無効時の両方の動作がカバーされていれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, typescript
領域
compilers
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
30/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。