Node.js has released a new long-term support (LTS) version, 20.16.0, called “Iron,” on July 24, 2024. This update brings new features and fixes new issues.
New Features: process.getBuiltinModule(id)
A key addition in this release is the ‘process.getBuiltinModule(id) function. This function helps load built-in Node.js modules in a global context. Here are its benefits:
1. Conditional loading for ES modules: Developers can now load built-in modules only when running in a Node.js environment. This helps with compatibility issues with other environments that don’t support these modules.
2. Consistent module access: These functions ensure that the correct built-in modules are always returned, even if ‘require.cache is changed. This makes interacting with core Node.js functions more stable.
Deprecation of OpenSSL Engine-Based APIs
Open SSL 3 no longer supports custom engines and suggests using the new provider model. Because of this, several APIs that relied on Open SSl engine functionality are now deprecated:
1. ‘clientCertEngine option in https.request(), tls.createSecureContext(), and tls.createServer()’
2. privateKeyEngine and privateKeyIdentifier options in tls.createSecureContext()
3. ‘crypto.setEngine()’
Developers should switch to the new Open SSL model for their applications.
Inspectors Bug Fix
A bug in the ‘Debugger.setAsyncCallStackDepth function has been fixed. This bug previously enabled asyn hooks incorrectly, causing problems when profiling with Chrome DevTools. The fix ensures that asyn hooks are disabled as expected when the deth is set to 0.
The Node.js v20.16.0 release offers valuable enhancements and fixes critical issues. With the new process.getBuiltinModule(id) function and the changes to OpenSSL engine-based APIs, this LTS version gives developers better tools and a smoother development experience.
Check out the complete details on the official website: https://nodejs.org/en/blog/release/v20.16.0