A module is one JavaScript file that a runtime loads as a unit and can connect to other files to share code. The same file can behave differently when treated as CommonJS or an ECMAScript module (ESM), and across runtimes; even the file extension can affect Node.js behavior. section 1.1
Table 1.1 Running the same code in five different runtimes yields six different results
|
Runtime
|
Variation
|
Results
|
|
Node.js
|
CommonJS
|
Hello
|
|
Node.js
|
ECMAScript module
|
elHo
l
|
|
Deno
|
ECMAScript module
|
elHlo
|
|
Bun
|
ECMAScript module
|
Helo
L
|
|
Chrome
|
CommonJS
|
Error! process.nextTick does not exit.
|
|
Cloudflare Workers
|
ECMAScript module
|
eHllo
|
Compare the outputs of one asynchronous-task puzzle across runtimes and module types: the results vary, and some environments reject APIs used by the script. section 1.1











































