What are ES Modules?
ES Modules, commonly called ESM, are the standardized JavaScript module system using import and export syntax. Modern Node.js supports ESM alongside CommonJS. ESM can be enabled through configuration such as package.json type: module or appropriate file extensions such as .mjs.
Key Takeaways
- ESM uses import/export.
- Node.js supports both ESM and CommonJS.
- Module-system configuration should be consistent within a project.
Knowledge Check
Which syntax is used by ES Modules?