Node.js 21 Released with V8 Update and New Features

Visit Us
Follow Me

Node.js developers have announced the release of version 21, featuring an update of the V8 JavaScript engine to 11.8 and the inclusion of stable versions of fetch and WebStreams. At the end of October, Node.js 21 will become the only active version, while Node.js 20 will transition to LTS (Long Term Support). The plan is to support version 21 for the next six months.

Key Highlights:

  • The fetch and WebStreams modules have gained stable status after a recent update. This affects WebStreams, FormData, Headers, Request, Response, and fetch modules, making it important for developers to take note.
  • An experimental WebSocket implementation has been added, which can be activated using the –experimental-websocket flag.
  • The V8 JavaScript engine has been included, ensuring support for new features and improved performance.
  • During test execution, glob expressions can now be used in parameters with the –test flag. This enables more flexible and convenient test execution. For example, you can run all .test.js files in multiple project directories using the command node --test **/*.test.js.
  • An experimental flag, –experimental-default-type, has been introduced, allowing you to change the default module system. It’s important to note that ES and CommonJS modules with explicit types remain unaffected. Only CommonJS modules with implicit definitions will be interpreted as ES by default under this flag.
  • By passing the –experimental-wasm-modules flag, files without extensions will be treated as WebAssembly if they start with \0asm.
  • Support for globalPreload has been removed, with a recommendation to use initialize for setting up communication between threads and register for sending data from the application thread.
  • Sometimes, data written to a file may remain available for subsequent operations for a period. In this release, a flush option has been added to the fs.writeFile family of functions, which forcibly clears files.
  • Optimization has been carried out on Writable and Readable streams by removing redundant checks and improving the callback scheduling system.

Author Profile

Martin Harris
I'm Martin Harris, a tech writer with extensive experience, contributing to global publications. Trained in Computer Science, I merged my technical know-how with writing, becoming a technology journalist. I've covered diverse topics like AI and consumer electronics, contributing to top tech platforms. I participate in tech events for knowledge updating. Besides writing, I enjoy reading, photography, and aim to clarify technology's complexities to readers.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *