TypeScript 4.7 beta with ECMAScript module support is out

published on 2022/04/09

For the last few years, Node.js has been working to support ECMAScript modules (ESM). This has been a very difficult feature, since the Node.js ecosystem is built on a different module system called CommonJS (CJS). Interoperating between the two brings large challenges, with many new features to juggle; however, support for ESM in Node.js was largely implemented in Node.js 12 and later. Around TypeScript 4.5 we rolled out nightly-only support for ESM in Node.js to get some feedback from users and let library authors ready themselves for broader support.

Microsoft

This is a huge improvement in finally bringing the JavaScript module capability into a stable state.

JavaScript have had the following module system in the past decades.

  • AMD
  • CJS
  • UMD
  • ESM

Let's hope ESM is the last module system for a long while.