microsoft / microsoft/TypeScript

`importHelpers` generates code, that is incompatible with browsers

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

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

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

説明

Currently enabling importHelpers adds

import * as tslib_1 from "tslib";

at the top of every source file.

Such notation is not compatible with browsers. Nowadays, all modern browsers supports Ecma modules, there's no reason for writing code that assumes Node.js environment + bundler build. Code should assume "Ecma modules" environment instead. And bundlers can stop being compilers and do the work they are supposed to do - create optimized builds (if needed at all).

The change is simple, importHelpers should generate:

import * as tslib_1 from "../../../node_modules/tslib/index.js";

The path to "node_modules" should be determined at compile time of course.

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

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

はじめの一歩

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

調査の方向性

まず、importHelpers の tslib import を出力する TypeScript コンパイラコードを追跡します。現在の module specifier と、要求されたブラウザー互換のパスを比較し、次に生成された import が Ecma modules 環境から解決されること、そして node_modules のパスがコンパイル時に決定されることを確認します。

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

評価

技術スタック
javascript, typescript
領域
compilers
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
42/100

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

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