MyGit

v21.1.0

nodejs/node

版本发布时间: 2023-10-24 22:00:29

nodejs/node最新发布版本:v23.3.0(2024-11-21 07:00:59)

Notable Changes

Automatically detect and run ESM syntax

The new flag --experimental-detect-module can be used to automatically run ES modules when their syntax can be detected. For “ambiguous” files, which are .js or extensionless files with no package.json with a type field, Node.js will parse the file to detect ES module syntax; if found, it will run the file as an ES module, otherwise it will run the file as a CommonJS module. The same applies to string input via --eval or STDIN.

We hope to make detection enabled by default in a future version of Node.js. Detection increases startup time, so we encourage everyone — especially package authors — to add a type field to package.json, even for the default "type": "commonjs". The presence of a type field, or explicit extensions such as .mjs or .cjs, will opt out of detection.

Contributed by Geoffrey Booth in #50096.

Other Notable Changes

Commits

相关地址:原始地址 下载(tar) 下载(zip)

查看:2023-10-24发行的版本