Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Support dynamic import under NodeJS

オープン
#36 コメント 4 件 リアクション 27 件 担当者 0 名 GitHub で見る

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

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
javascript, nodejs
領域
tooling

調査の方向性

まず、vm.Script がどこで構築されるか、そして nodeInstrumenter オプションがその経路にどのような影響を与えるかを追跡します。アプローチを選ぶ前に、Node の importModuleDynamically API とリンクされている Node issue を確認してください。完了の条件は、nodeInstrumenter のサポートを削除せずに、ESM ではない NodeJS コンテキストで動的 import が機能することです。

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

説明

In a non-ESM context normally import() can be used to bring in ESM code. Under this loader this will be true for browsers, but not NodeJS which does not include an implementation by default for scripts constructed with vm.Script.

Downstream this complicates extension development in VSCode as it means ESM packages can only be used if first transformed into a compatible syntax (usually by a bundler). Note that the extension development host appears to load extensions without using this loader, so such dynamic import restrictions will not be seen there.

At present, I can see 2 paths towards supporting dynamic import.

  1. Supply a callback via the importModuleDynamically option (this API and those which may be needed for the implementation are marked experimental, it may be worth waiting on https://github.com/nodejs/node/issues/37648)
  2. Forfeit the nodeInstrumenter option so the implementation can be simplified to just require (by far easiest and not blocked by experimental API, but will be a breaking change)
    EDIT 2023-03-13: On closer inspection, it appears I read the codepath wrong. This is not an option.

Downstream issue: https://github.com/microsoft/vscode/issues/130367

主要言語
JavaScript
スター
181
フォーク
62
平均マージ
2日 5時間
マージ済み PR(30日)
1

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

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

microsoft/vscode-loader のほかの issue

microsoft/vscode-loader の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

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

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