It’s been just over six months since I published the first edition of ‘What’s new in Node.js core?’. A lot of new features have shipped in Node.js Core since then, so it felt like a good time to put together a new edition.
You can find all the code examples in this edition on GitHub (I’ll be continuing to add examples there, so you might want to give it a "watch").
The pace at which new features are being implemented and shipped is really quite impressive. A massive thank you to all the Node.js contributors for their huge efforts in pushing the Node.js project forward.
🌟 New features
We no longer need to use hacks to deep clone objects in Node.js.
In Node.js you can now automatically cancel async operations, such as a slow HTTP request.
Making HTTP requests in Node.js just got easier with an experimental Fetch API implementation.
Node.js now supports importing JSON files in ES modules without the need to pass an experimental flag.
It’s now possible to provide a reason value when triggering an abort signal in Node.js.
abortSignal.throwIfAborted() method makes it easier to write code that handles abort signals.
There’s another pretty new promise-based API in Node.js core: the
🎞️ Video walkthrough
I’ll be recording a video walkthrough of code examples using these new features. Drop your email address in below if you’d like to watch the preview when it’s ready.
I won’t send you spam. Unsubscribe at any time.
💎 Other notable features
Here are some other notable features that have landed in Node.js core recently:
- Error cause — Allows you to chain errors and retain contextual information (feature explainer on the V8 blog). Added v16.9.0.
- Improved support for the node: protocol — Using the
require()was backported in v14.18.0.
- Corepack (experimental) — Makes it easier to use Yarn or pnpm as the package manager on your Node.js projects. Added v16.9.0.
- Node.js version now printed after stack trace on fatal exceptions that cause exit — Added in v17.0.0.
- url.urlToHttpOptions() — Converts a WHATWG URL object into an object that can be passed to
https.request(). Added in v15.7.0, backported to v14.18.0.
- HTTPS and HTTP imports (experimental) — "Importing network based modules using https: and http: is supported under the
--experimental-network-importsflag". Added v17.6.0.
- Scheduler API (experimental) — "An experimental API defined by the Scheduling APIs draft specification being developed as a standard Web Platform API". Added v17.3.0, backported to v16.14.0.
- Web Streams API (experimental) — "An implementation of the WHATWG Streams Standard". Added v16.5.0.
📅 Node.js releases
There are a few things to highlight about the Current and Long Term Support (LTS) Node.js release lines:
- v12 is end-of-life (EOL) at the end of April — The v12 release line enters end-of-life status on April 30th 2022. It will no longer receive critical bug fixes or security patches.
- v16 is the Active LTS release line — Since October 26th 2021 (v16.13.0). In production you should ideally be using a v16 or v14 release. v14 is in Maintenance LTS until April 30th 2023.
- v18 release coming soon — This will include all the features that have been baking in the v17 (Current) release line. Initial release scheduled for April 19th 2022, see the Version 18.0.0 release issue on GitHub for what will be included. Will enter Active LTS on October 25th 2022.
If you want to learn more about how the Node.js release schedule works, check out the Long Term Support (LTS) schedule page on the Node.js website.