Prerequisites: NodeJS 20.14.0.
Do the following:
- Run
cd ./esm - Run
npm install - Run
npx tsx .\src\variant1.ts- should log2to the console - Run
npx tsx .\src\variant2.ts- should log2to the console - Run
cd .. - Run
cd ./cjs - Run
npm install - Run
npx tsx .\src\variant1.ts- should log2to the console - Run
npx tsx .\src\variant2.ts- should log2to the console BUT IT LOGS1 - Change
tsxversion inpackage.jsonto version4.11.2 - Run
npx tsx .\src\variant2.ts- should log2 - Change
tsxversion inpackage.jsonto version4.12.0 - Run
npx tsx .\src\variant2.ts- should log2to the console BUT IT LOGS1
The difference between the folders is that:
./esm/package.jsonhastype="module"./cjs/package.jsonhastype="commonjs"
The difference between the variants is that the dynamic imports are sorted differently.