Web Development
Published: Oct 28, 2024

Node.js 23: Key Updates and Improvements You Must Know

Verified
Verified Expert in Project management
Faisaluddin is a Project Lead passionate about successful software delivery.
Upgrade to Node.js 23: Key Changes & Features

Quick Summary: The NodeJS team is always up for bringing the best to this runtime environment. They have again made it with the release of NodeJS 23 which offers notable changes to boost performance and enhance developer experience. Explore the new updates in Node.js 23 that have created excitement among the dev community in this article.

Once again, there is a lot of buzz in the developer community as Node.js 23 has been launched. It has created excitement spawning debates about its features and updates. So, what does Node.js bring to the table for the developer community?

In this article, we will discuss the new Node.js 23 release in detail and highlight the key changes and updates. With the launch of Node 23 in Oct 2024, it has now become the ‘Current’ release, and NodeJS 22 is now promoted to LTS (Long-Term Support).

A big update is “require()” for ES modules that were introduced in Node 22 and are now enabled by default in the new release. There are many other notable changes that we have covered in this article. So, let’s check out what the new release has in store for us.

Get the Benefits of Performance Optimization and a Lot of New Features by Switching to Node 23

Make a Smooth Transition
On This Page
  1. NodeJS 23: A Quick Overview
  2. What are the Updates in Node.js 23?
  3. Start Your Transition to Node 23 Today!

NodeJS 23: A Quick Overview

The developer community doesn’t require an introduction to NodeJS as they know how powerful it is. It’s well-known for its amazing features and versatility, which makes it a prominent choice for various software development projects.

The latest version of this JavaScript runtime environment brings new enhancements in terms of functionality and better performance. Hence, upgrading to the newest version is indispensable to get the best of it. Installing the latest version of NodeJS requires a few simple steps.

As NodeJS 23 is out as the fresh version, it will remain in the ‘Current’ release line for the next six months. The new version offers many improvements and features. The key highlight of the improvements is default support for require(esm).

This new version also offers performance boosts with many improvements in these aspects. For example, the addition of on-disk code caching provides faster startup. Plus, there are improvements in buffer and file system performance.

You can check out the latest release document for more changes and improvements to Node JS.

What are the Updates in Node.js 23?

More than 2641 commits were made to the core and components of NodeJS to bring the new release of this JS runtime environment. However, much of the work was related to enhancing the existing features and behavior, and there isn’t a big announcement this time.

Yet there are some notable changes that have made this release special for NodeJS developers. Let’s check out these changes in detail.

Default Support for require(esm)

One of the key updates in NodeJS 23 is require(esm) enabled by default to load native ESM modules. Though this feature is already available on Node JS 20.x and 22.x versions, it requires an additional step of using the command line flag --experimental-require-module. But now, it is enabled by default, which enhances the developer experience.

It makes it easy to work with ESM modules by offering default functionality for synchronously loading ESM modules with require(). However, you must note that it is still experimental and can be disabled with --no-experimental-require-module if you get any issues. Now, Node will not throw ERR_REQUIRE_ESM if this feature is not disabled. Instead of an error, it will show an experimental warning.

You can check if this feature is enabled by checking process.features.require_module.

A Stable node --run Command

Node 23 now offers a stable and efficient node --run command that helps execute scripts in package.json file without using npm. The use of a stable node --run command simplifies executing common tasks like deploying applications, performing tests, and building the project by running scripts easily.

There is a package.json file for your application like:

{

“name”: ”demo-app”,

“version”: “0.0.1”,

“scripts”: {

“start”: “node demo.js”

}

}

You can use the below command to start the application:

> node --run start

It worked!

Since the node --run command can execute JavaScript code, developers can also use it for quick experimentation and testing like:

node --run ‘console.log(“A demo script”)’

Stabilizing this feature will offer more flexibility to routine tasks and experimentation.

Experimental Support for TypeScript

Node.js 23 has something useful for developers with experimental TypeScript support. So, TypeScript developers can execute “.ts” files and code in their favorite language with this feature. Developers don’t require additional tools or plugins for writing and executing TypeScript code with this feature.

Keep in mind that it is still experimental and might cause some errors. However, you can benefit from this feature if you are experimenting with TypeScript. To enable this feature, you need to use two flags: --experimental-strip-types and --experimental-transform-types.

With these options enabled, you can use TypeScript like this:


demo.js

import { GreetingOptions } from './greetings.ts'

import greetings from './greetings.ts'

const message: string = 'There';

const greet: string = greetings(GreetingOptions.Hi, message);

console.log(greet);

greetings.js

export enum GreetingOptions {

Hi,

Goodbye

};

export default function (helloType: GreetingOptions, greet: string) : string {

let world: string;

if (helloType === GreetingOptions.Hi) {

world = 'Hi ' + greeting;

return world;

};

throw Error('Unknown GreetingOption');

};

Output

>node --experimental-strip-types --experimental-transform-types demo.ts

(node:1216886) ExperimentalWarning: Type Stripping is an experimental feature and might change at any time

(Use `node --trace-warnings ...` to show where the warning was created)

Hi There


Experimental Addition of SQLite

Another good news for developers is that Node.JS 23 offers an experimental SQLite API to support the Web Storage APIs. SQLite, being a simple and lightweight database, offers developers a lot of advantages when it comes to data management.

With the help of this built-in API, you can use SQL queries to populate a database or query a database stored on the disk or present in memory. This feature is very useful for prototyping or small projects. It enhances the flexibility of NodeJS.

Experimental Web Storage APIs

The implementation of sessionStorage and localStorage APIs is another important update in Node 23, which is an effort towards improving web compatibility. Developers can use this feature to store data persistently on the disk or for a session with key/value pairs.

Using this feature also offers consistency across client and server environments due to the use of similar approaches across these environments. Methods like setItem and getItem help store and retrieve data. They are more intuitive than cookies and helpful in managing user sessions.

Developers who are familiar with using Web Storage functionality with other environments can now take advantage of it with Node.js and store data with this method instead of cookies.

Windows 32-bit Support Gone

Support for Windows 32-bit has officially ended with Node.js 23. With this step, the Node team can focus on platforms that are up-to-date and widely used. You need to upgrade your Windows to 64-bit with Node 23. However, you can stay with the previous version if you want to continue with 32-bit.

Choose the Top 1% of NodeJS Talent for Exceptional Services That Turn Your Idea into Reality

Let’s Join Hands

Start Your Transition to Node 23 Today!The release of Node.js 23 brings new enhancements, features, and updates that offer a seamless development experience. It offers security and performance improvements. As we focus on the latest technologies for our web development projects, we are ready to work with Node JS 23 to help our clients build state-of-the-art solutions for their businesses.As a trusted Node.js development company, we make your transition smooth and hassle-free, ensuring zero downtime deployment. We will help you overcome any challenges or bottlenecks during the transition. Our development team will assist you through the entire process.Contact us to get the benefits of the latest Node.js version with a frictionless transition.

Don't Forget to share this post!

Faisaluddin Saiyed

Faisaluddin Saiyed

Verified
Verified Expert in Project management
View All Posts

About the Author

Faisaluddin is a dynamic Project Orchestrator passionate about driving successful software development projects. His enriched 11 years of experience and extensive knowledge spans NodeJS, ReactJS, PHP & frameworks, PgSQL, Docker, version control, and testing/debugging. Faisaluddin's exceptional leadership skills and technical expertise make him a valuable asset in managing complex projects and delivering exceptional results.