What’s New in Node.js 19? Features & Updates That You Must Know Posted on 7 November 2022 by Ankur Akvaliya Node.js 19 is now live! And I know you’re too much excited to know the features and major updates that are introduced in Node.js 19. If you ask me about what’s exciting about Node.js 19, then I must say that you can expect new releases approximately every two weeks. Since this is an odd-numbered release line, Node version 19 will not be promoted to LTS. Let’s move ahead with your question about what’s new in Node.js 19. Overview of Node.js 19 With the release of Node.js 19 in the market, a big convenience for Node.js developers came where they can easily deal with early feature testing. Some of the key highlights that are introduced with Node.js 19 include the update of the V8 JavaScript engine to 10.7 and HTTP(s)/1.1 KeepAlive enabled by default. Node.js 19 will effectively become the “Current” release line and is going to replace Node.js 18 definitely when it enters long-term support (LTS). So, till then, Node.js 19 will officially be the ‘Current’ release for the next six months, until April 2023. Build High-Performance Web Apps Using Our Node.js Web Development Solutions We help you build Node.js development services to build real-time, function-rich, scalable web applications for all your business needs. Contact Us What are the Updates on Node.js 19? Node.js is going to benefit you in many ways especially for dealing with back-end development services. It’s time to explore the major updates that have been introduced the Node.js 19 version. node –watch (experimental) Support for running in “watch” mode using the node —watch option is an intriguing new feature recently added to the runtime. It will restart when an imported file is updated while your application is running in “watch” mode. $ node –watch index.js This feature is available in v19.0.0 and v18.11.0+. Let’s explore this feature with an example. In our server/index.js: Copy const express = require("express"); const path = require("path"); const app = express(); app.use(express.static(path.join(__dirname, "../build"))); app.listen(8080, () => console.log("Express server is running on localhost:8080") ); So, we were using a nodemon tool to run the server and to make instant file changes whenever we restarted our application. We were using the “nodemon server” command to apply the effect for the same. Now, with the release of node.js 19, you do not need to type such a command or install the additional tool. Instead, just execute the command “node –watch” to automatically restart the application when file changes are detected. Copy % node --watch server (node:67643) ExperimentalWarning: Watch mode is an experimental feature. This feature could change at any time (Use `node --trace-warnings ...` to show where the warning was created) Express server is running on localhost:8080 HTTP(S)/1.1 KeepAlive by default Node.js 19 sets keepAlive to true by default. This means that any outgoing HTTP(s) connection will automatically use HTTP 1.1 keepAlive. The default keepAlive duration is 5 seconds. If we consider the same example, Copy const http = require('node:http'); console.log(http.globalAgent); const https = require('node:https'); console.log(https.globalAgent); And if we use Node.js 16 to run the file using the command “nvm use 16”, you’ll see that HTTP.globalAgent and HTTPS.globalAgent set keepAlive false. But that’s not the case with Node.js 19. If you execute the server with “nvm use 19”, the output goes something like this. HTTP.globalAgent sets keepAlive true, and the default keepAlive duration is 5 seconds (5000 ms). HTTPS.globalAgent sets keepAlive true, and the default keepAlive duration is 5 seconds (5000 ms). Keeping keepAlive to true will generally deliver better throughput as connections are reused by default. Stable WebCrypto The WebCrypto API is a feature-rich interface that helps you build systems using cryptography. With node.js 19, the WebCrypto API is stable (by excluding the algorithms: Ed25519, Ed448, X25519, and X448). To access this module, you can use globalThis.crypto or require(‘node:crypto’).webcrypto. Let’s go through an example where we will perform a number of low-level cryptographic functions: Copy const { subtle } = globalThis.crypto; (async function() { const key = await subtle.generateKey({ name: 'HMAC', hash: 'SHA-256', length: 256 }, true, ['sign', 'verify']); console.log('key =', key); const enc = new TextEncoder(); const message = enc.encode('I love cupcakes'); console.log('message =', message); const digest = await subtle.sign({ name: 'HMAC' }, key, message); console.log('digest =', digest); })(); (The above code is taken from GitHub) If you run the server, the output goes like this. Copy % node server key = CryptoKey { type: 'secret', extractable: true, algorithm: { name: 'HMAC', length: 256, hash: [Object] }, usages: [ 'sign', 'verify' ] } message = Uint8Array(15) [ 73, 32, 108, 111, 118, 101, 32, 99, 117, 112, 99, 97, 107, 101, 115 ] digest = ArrayBuffer { [Uint8Contents]: <30 01 7a 5c d9 e2 82 55 6b 55 90 4f 1d de 36 d7 89 dd fb fb 1a 9e a0 cc 5d d8 49 13 38 2f d1 bc>, byteLength: 32 } Custom ESM Resolution Adjustments Node.js has removed the –experimental-specifier-resolution flag. Its functionality can now be achieved via custom loaders. Dropped DTrace/SystemTap/ETW Support For the following two reasons, Node.js has dropped the support for DTrace/SystemTap/ETW: There are no clear indicators anyone is using DTrace, SystemTap, or ETW. The complexity of maintaining and supporting these tools has proved not worth the effort. V8 JavaScript engine is updated to V8 10.7 Node.js 19 has updated the V8 JavaScript engine to V8 10.7, which includes a new function, Intl.NumberFormat, for language-sensitive number formatting. Intl.NumberFormat(locales, options) locales is an optional parameter, which is a BCP 47 language tag or an array of such strings. These are the major changes that have been introduced in Node.js version 19. If you need any help regarding Node.js installation or upgradation, hire Node.js developers on part-time or full-time basis. Upgrade to Node.js 19 Now! What are you waiting for? Go ahead and download Node.js 19.0.0 today. Being a Node.js development company Australia, we have a team of expert Node.js developers for hire who are proficient in dealing with application testing and modules in the Node.js 19 version. And yes, by selecting Node.js as your preferred technology for your project needs, you can efficiently build responsive web apps. find the release post of Node v19.0.0 (Current) which contains the full list of commits included in this release.