mirror of
https://github.com/nodejs/node.git
synced 2026-10-28 10:15:07 +08:00
doc: clarify require/import mutual exclusivity
PR-URL: https://github.com/nodejs/node/pull/33832 Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com>
This commit is contained in:
1 parent
f63436d190
commit
f89530fccc
1 file changed
+2
@@ -424,8 +424,10 @@ Node.js supports the following conditions:
|
||||
* `"import"` - matched when the package is loaded via `import` or
|
||||
`import()`. Can reference either an ES module or CommonJS file, as both
|
||||
`import` and `import()` can load either ES module or CommonJS sources.
|
||||
_Always matched when the `"require"` condition is not matched._
|
||||
* `"require"` - matched when the package is loaded via `require()`.
|
||||
As `require()` only supports CommonJS, the referenced file must be CommonJS.
|
||||
_Always matched when the `"import"` condition is not matched._
|
||||
* `"node"` - matched for any Node.js environment. Can be a CommonJS or ES
|
||||
module file. _This condition should always come after `"import"` or
|
||||
`"require"`._
|
||||
|
||||
Reference in new issue
Block a user