0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

親子対話:Node.jsの.mjsって何? — 食材の仕入れ

0
Posted at

父「.mjs って何だ。.js と何が違う」

娘「食材でたとえるなら、.js は常温保存の乾物。.mjs は冷蔵庫に入ってる生鮮品」

父「どっちも料理に使えるんだろ」

娘「使える。でも取り出し方が違う。乾物(CommonJS)は require() で必要な分だけ取り出す。生鮮品(ESM)は import/export で「これください」と宣言してから使う」

父「どっちがいいんだ」

娘「どっちもいい。でも新しい厨房(Node.js)はだんだん生鮮品(ESM)対応が標準になってきてる」

父「つまり .mjs は新しいNode.jsの流儀ってことか」

娘「そう。post-qiita も .mjs で書いてある。モダンな厨房で料理するなら、.mjs が便利」

父「なるほど。食材の仕入れ方がわかった」

娘「次はその食材を料理する道具を揃えよう」

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?