@@ -109,11 +109,21 @@ provides interoperability between them and its original module format,
109109
110110Node.js has two module systems: [ CommonJS] [ ] modules and ECMAScript modules.
111111
112- Authors can tell Node.js to use the ECMAScript modules loader via the ` .mjs `
113- file extension, the ` package.json ` [ ` "type" ` ] [ ] field, the [ ` --input-type ` ] [ ]
114- flag, or the [ ` --experimental-default-type ` ] [ ] flag. Outside of those cases,
115- Node.js will use the CommonJS module loader. See [ Determining module system] [ ]
116- for more details.
112+ Authors can tell Node.js to interpret JavaScript as an ES module via the ` .mjs `
113+ file extension, the ` package.json ` [ ` "type" ` ] [ ] field with a value ` "module" ` ,
114+ the [ ` --input-type ` ] [ ] flag with a value of ` "module" ` , or the
115+ [ ` --experimental-default-type ` ] [ ] flag with a value of ` "module" ` . These are
116+ explicit markers of code being intended to run as an ES module.
117+
118+ Inversely, authors can tell Node.js to interpret JavaScript as CommonJS via the
119+ ` .cjs ` file extension, the ` package.json ` [ ` "type" ` ] [ ] field with a value
120+ ` "commonjs" ` , the [ ` --input-type ` ] [ ] flag with a value of ` "commonjs" ` , or the
121+ [ ` --experimental-default-type ` ] [ ] flag with a value of ` "commonjs" ` .
122+
123+ When code lacks explicit markers for either module system, Node.js will attempt
124+ to run JavaScript as CommonJS; if it errors due to syntax that is only supported
125+ in ES modules, it will try again to run the code as an ES module. See
126+ [ Determining module system] [ ] for more details.
117127
118128<!-- Anchors to make sure old links find a target -->
119129
0 commit comments