With Node 12 and up supporting ES Modules natively and Node 10 — the last version to not support it unflagged — going EOL, it’s time to start migrating your code to ES Modules. Aral Balkan took the time to convert his tool “Place” to embrace them and documented his work:
Yesterday, I refactored Place, which is a non-trivial Node.js app, to use ECMAScript Modules (ESM). Here’s a diff of the full set of changes.
This is the approach I took and some of the issues I ran into, in case it helps someone else
First step: set
"type": "module" in your
Related: Also see Sindre Sorhus’ post Get Ready For ESM