From 2cbb358c234a1c2e3caa8561125ad8e92755ca40 Mon Sep 17 00:00:00 2001 From: Lucas Azzola Date: Tue, 26 Nov 2019 22:30:11 +1100 Subject: [PATCH] doc: clarify required flag for extensionless esm Fixes: https://github.com/nodejs/node/issues/30655 PR-URL: https://github.com/nodejs/node/pull/30657 Reviewed-By: Yorkie Liu Reviewed-By: Myles Borins --- doc/api/esm.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/api/esm.md b/doc/api/esm.md index 57db302c307d7b..a77e01350b596a 100644 --- a/doc/api/esm.md +++ b/doc/api/esm.md @@ -87,7 +87,8 @@ If the nearest parent `package.json` lacks a `"type"` field, or contains `"type": "commonjs"`, extensionless and `.js` files are treated as CommonJS. If the volume root is reached and no `package.json` is found, Node.js defers to the default, a `package.json` with no `"type"` -field. +field. "Extensionless" refers to file paths which do not contain +an extension as opposed to optionally dropping a file extension in a specifier. `import` statements of `.js` and extensionless files are treated as ES modules if the nearest parent `package.json` contains `"type": "module"`.