Skip to content

Commit

Permalink
doc: clarify required flag for extensionless esm
Browse files Browse the repository at this point in the history
Fixes: #30655

PR-URL: #30657
Reviewed-By: Yorkie Liu <[email protected]>
Reviewed-By: Myles Borins <[email protected]>
  • Loading branch information
azz authored and BethGriggs committed Feb 6, 2020
1 parent de3fdfa commit 2cbb358
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion doc/api/esm.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"`.
Expand Down

0 comments on commit 2cbb358

Please sign in to comment.