How to Use ES Modules in a Node.js Project
· 5 min read
Modern JavaScript shares code between files with import and export, a system called ES modules. Node.js only reads a .js file that way when the project says so, and a new npm project says the opposite. One command, npm pkg set type=module, switches the project over.
