Node.js 23 has arrived, packed with exciting updates and powerful features for developers. This latest release brings a host of improvements that make Node.js faster, more efficient, and more versatile than ever before. For developers engaged in Node.js development, keeping up with these changes is crucial to maximising productivity and performance. In this post, we’ll dive into Node.js 23’s standout features, enhancements, and why it’s a game-changer for web and software development.
What Are the Updates in Node.js 23?
We’re excited to announce the release of Node.js 23! This version brings several impactful updates aimed at improving both developer experience and application performance. Here’s a look at the key highlights:
- Enabling require(esm) by Default: Native ES module loading using require() is now enabled by default.
- Dropping Support for Windows 32-bit Systems: Node.js 23 no longer supports Windows 32-bit, streamlining focus on more widely used systems.
- Stabilising the node –run Command: The –run command has been stabilised, improving command-line functionality.
- Enhanced Test Runner: New support for glob patterns in test runner coverage files enables more flexible testing options.
🚀 Node.js 23 is here! 🚀
New features, performance boosts, and a smoother developer experience. With better compatibility and stability, Node.js 23 delivers more power for building efficient apps.
Read here: 👉https://t.co/eQPMJSOuPH#NodeJS #JavaScript #WebDevelopment pic.twitter.com/4swcjE7pm2
— Node.js (@nodejs) October 16, 2024
Node.js 23 will replace Node.js 22 as the “Current” release line once Node.js 22 enters Long-Term Support (LTS) later this month. This means Node.js 23 will be the Current release for the next six months, remaining so until April 2025. Below, we break down some of these key features in more detail.
Enabling require(esm) by Default
One of the most anticipated updates in Node.js 23 is the default enablement of native ES module support with require(). In earlier Node.js versions like v20.x and v22.x, this feature was only accessible through the –experimental-require-module flag. However, in Node.js 23, require(esm) is enabled by default, making it easier for developers to load ES modules natively without additional configuration.
How It Works:
When using require() to load an ES module in Node.js 23, the runtime no longer throws an error (ERR_REQUIRE_ESM) if the require() method encounters a native ES module. However, it may throw ERR_REQUIRE_ASYNC_MODULE if the module or any of its dependencies include top-level await statements. When successfully loaded, the ES module will return as a namespace object similar to the one provided by the import() statement. This object can be verified using util.isModuleNamespaceObject().
Key Notes on require(esm):
- Feedback and Experimental Phase: Since this feature is still experimental, developers can provide feedback on any issues or regressions by reporting them to the Node.js issue tracker.
- Disabling the Feature: If necessary, you can disable require(esm) using the –no-experimental-require-module flag.
- Version Synchronisation: The unflagging of require(esm) may eventually be backported to Node.js 22.x after further testing and feedback.
To check if require(esm) is enabled in your Node.js instance, you can use process.features.require_module. This feature is expected to simplify module management and make it easier for developers to work with both require() and import in the same project.
Removal of Windows 32-bit System Support
Node.js 23 has officially dropped support for 32-bit Windows systems. This update reflects a shift toward prioritising resources for 64-bit systems, which are more widely used and offer better performance. For developers working in software development on Windows, this change means that applications running on 32-bit Windows environments should either upgrade their operating systems or remain on an earlier Node.js version.
This decision allows the Node.js team to focus on optimising performance and security for the majority of users, ensuring that Node.js remains efficient and up-to-date.
Stabilisation of the node –run Command
The node –run command, introduced as an experimental feature in previous versions, has been stabilised in Node.js 23. This command streamlines script execution directly from the command line, making it more reliable for production use.
The –run flag improves workflows for developers by enabling quick execution of scripts without complex setups. Whether for testing, debugging, or deploying small applications, the stabilised node –run command simplifies common development tasks, particularly for teams focused on web development.
Enhanced Test Runner with Glob Pattern Support
Node.js 23 includes improvements to its built-in test runner, including support for glob patterns when specifying coverage files. This enhancement allows developers to specify multiple files or directories for test coverage in a single line, making the testing process more efficient and less prone to human error.
Example Usage of Glob Patterns: Using a glob pattern, you can specify multiple test files like this:
node test_runner –coverage ‘./tests/**/*.test.js’
This flexibility allows developers to include or exclude specific files and folders more easily, speeding up the testing process for projects with large codebases.
Deprecation of OpenSSL Engine-based APIs
Node.js 23 has deprecated the OpenSSL Engine-based APIs, which were used for extending cryptographic functions. This deprecation encourages developers to shift toward more secure, modern cryptographic methods. It’s a forward-looking decision aimed at enhancing security standards across Node.js applications.
Removal of Experimental Policy Feature
Node.js 23 has removed the experimental policy feature, which was previously used to control loading behaviour through policy files. This change simplifies Node.js’s feature set and refocuses the platform on stable, widely adopted configurations.
Platform Support Updates
Alongside the removal of support for Windows 32-bit, Node.js 23 has updated its platform support to align with current operating system trends. This update improves compatibility and performance on recent OS versions, enabling developers to take full advantage of newer technologies.
Web Storage API (Experimental)
Node.js 23 introduces an experimental Web Storage API, providing support for localStorage and sessionStorage in server environments. This addition brings web-like storage functionality to Node.js, allowing developers to use familiar storage techniques traditionally seen in front-end development. While still experimental, the Web Storage API holds potential for building applications that need simple data storage solutions without a database.
Experimental TypeScript Support
For the first time, Node.js 23 includes experimental TypeScript support, allowing developers to use TypeScript directly in Node.js without extra configuration. This update is a significant step toward making Node.js more TypeScript-friendly, appealing to the growing community of TypeScript developers and enabling smoother integration for type-safe applications.
Other Key Improvements in Node.js 23
Node.js 23 also includes a range of other enhancements that benefit both developers and businesses. Here are some additional highlights:
- Updated V8 Engine: Node.js 23 runs on the latest V8 JavaScript engine, providing faster execution and improved memory management.
- Native Support for ES2023 Features: Support for the latest ES2023 syntax and features, like Top-Level Await and the Temporal API, which enhances date handling.
- Enhanced Console Output: Improved console formatting makes debugging more intuitive, which is particularly helpful for developers focusing on Node.js development.
- Improved TLS and HTTP/3 Support: With better support for HTTP/3 and TLS, Node.js 23 provides a more secure environment for building real-time, data-intensive applications.
Benefits of Node.js 23 for Developers and Businesses
For companies and developers involved in software development, Node.js 23 offers several benefits that enhance both productivity and performance:
- Scalability: Improved performance allows for more scalable applications that can handle higher traffic without compromising speed or reliability.
- Security: Enhanced encryption protocols and secure connections reduce the risk of data breaches, which is crucial for modern businesses.
- Faster Development: Features like require(esm) by default and the stabilised node –run command streamline workflows, helping developers focus on building applications without technical roadblocks.
Node.js 23 also presents new possibilities for web development projects, enabling the creation of high-performing, real-time applications suited to the demands of today’s digital landscape.
Why Upgrade to Node.js 23?
Upgrading to Node.js 23 brings a range of benefits that help developers and companies stay competitive. From enhanced security and speed to innovative features like native ES module support, Node.js 23 offers tools that improve productivity and project outcomes. By leveraging these updates, teams can build scalable, secure applications with streamlined workflows and reduced infrastructure requirements.
Need help upgrading or developing with Node.js 23? Hire a Node.js developer from our team to implement these new features in your projects. As a top Node.js development company, EvinceDev ensures high-quality, future-ready solutions tailored to your business needs.