Should literal dynamic import('pkg') follow into the module graph?

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

メンテナーはふだん 1 日以内に返信

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

評価

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

調査の方向性

Start by reading the dynamic import handling that emits SC2013, then compare it with static import graph construction and the related issue #363 and corpus case 9537. The issue asks whether literal dynamic imports should enter the module graph, including package type handling and evaluation or interop constraints; done means resolving that design question and implementing the agreed behavior.

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

説明

scriptc 0.4.11, main at 918d80b26a, macOS arm64.

Question: should a literal import("pkg") follow into the module graph like a static import?

const m = await import("ms");
console.log(m.default(1000));

With no static import of ms, the build refuses with SC2013 and the package is not compiled. A literal specifier is statically known, so it could be added to the graph the same way a static import is, with the namespace typed from the package types. Is that feasible, or is there a blocker (evaluation order, conditional loading, ESM/CJS interop)? Related: #363 and corpus case 9537.

PR #3527 improves the diagnostic meanwhile: it names the package (not @types/ms) and hints at adding a static import.

主要言語
TypeScript
スター
6.5k
フォーク
212
平均マージ
13時間 46分
マージ済み PR(30日)
787

環境構築

はじめの一歩

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

vercel-labs/scriptc のほかの issue

vercel-labs/scriptc の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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