NPM and NodeJS should do more to make ES Modules easy to use
Boris Cherny's Blog
June 19, 2024
Coming back to JavaScript and TypeScript after a few years neck deep in Python and Hack, I kept hitting a number of new, cryptic errors when running NodeJS code in my dev environment:
# when I ran ESM TypeScript code the wrong way:
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module
# when I imported an ESModule from a .ts file:
error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls
# when I used ES6 import syntax i...
Read more at borischerny.com