[Node 20] ESM Loaders no longer have `process.argv` access
まだ誰も着手していません。
- 主要言語
- JavaScript
- スター
- 122k
- フォーク
- 37.3k
- 平均マージ
- 4日 2時間
- マージ済み PR(30日)
- 283
説明
Version
20.x
Platform
Darwin MacBook-Pro-2.local 21.3.0 Darwin Kernel Version 21.3.0: Wed Jan 5 21:37:58 PST 2022; root:xnu-8019.80.24~20/RELEASE_ARM64_T6000 arm64
Subsystem
No response
What steps will reproduce the bug?
// foo.mjs
console.log('argv:', process.argv);
// bar.mjs
console.log('hello from bar', process.version);
Run:
$ node --loader ./foo.mjs bar.mjs --hello=world
Output:
$ node --loader ./foo.mjs bar.mjs --hello=world
# (node:37260) ExperimentalWarning: Custom ESM Loaders is an experimental feature. This feature could change at any time
# (Use `node --trace-warnings ...` to show where the warning was created)
# argv: [
# '/.../.volta/tools/image/node/18.12.1/bin/node',
# '/.../bar.mjs',
# '--hello=world'
# ]
# hello from bar v18.12.1
$ volta install node@20.2.0 # or any 20.x
$ node --loader ./foo.mjs bar.mjs --hello=world
# (node:37288) ExperimentalWarning: Custom ESM Loaders is an experimental feature and might change at any time
# (Use `node --trace-warnings ...` to show where the warning was created)
# argv: [ '/.../.volta/tools/image/node/20.2.0/bin/node' ]
# hello from bar v20.2.0
How often does it reproduce? Is there a required condition?
Every time.
What is the expected behavior? Why is that the expected behavior?
Have access to process.argv
What do you see instead?
Doesn't receive any arguments beyond node path
Additional information
This is a breaking change introduced by #44710 & it was not listed in the PR notes.
Additionally, this breaking change wasn't listed in the 20.x Changelog
As indicated by https://github.com/nodejs/node/pull/44710#issuecomment-1609957745, the knowledge of this impact is assumed based on the user understanding (& awareness) of loaders now being off main thread.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、issue に示されている Node 18.x と 20.x のコマンドを foo.mjs と bar.mjs で再現します。意図された動作を理解するため、リンク先の #44710 の議論と doc/changelogs/CHANGELOG_V20.md の Custom ESM Loader Hooks セクションを読みます。process.argv のリグレッションを解決するか、確認された breaking change を適切なリリースノートに記載すれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript, node.js
- 領域
- backend
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 活発
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100