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