The Latest in Node.js Development for 2024

The Latest in Node.js Development for 2024

Node.js Development: Notable Changes from Version 18 to Version 22


2 min read

Node Fetch Built-in

With Node.js 18, developers can write cleaner, more efficient code thanks to built-in fetch support, eliminating the need for external libraries.

node index.js

Node Fetch built-in in NodeJs 18

Read .env File Natively

Node.js 20 introduces native support for .env files, making it easier to manage environment variables. You no longer need to use the dotenv package.

node --env-file=.env.local index.js

Read .env file  with NodeJs 20

Testing with node:test

The node:test library in Node.js 20 simplifies the setup and reduces dependencies needed for projects.

node --test

Node runner with NodeJs 20

Task runner with node --run

The node --run command introduced in Node.js 22 provides a built-in mechanism for a task runner, complementing but not replacing existing package managers like npm, yarn, or pnpm.

Intentional limitations

node --run is not meant to match the behaviors of npm run or of the run commands of other package managers. The Node.js implementation is intentionally more limited, in order to focus on top performance for the most common use cases.

node --run start

Task runner with NodeJs 22

Permission model

Node.js 22 enhances application security with an experimental permission model (--experimental-permission), offering controls similar to those seen in Deno.

node --experimental-permission index.js

experimental-permission with NodeJs 22

Import ESM modules from CJS

The ability to import ESM modules from CommonJS scripts under the --experimental-require-module flag in Node.js 22 simplifies module management and encourages the adoption of ESM.

node --experimental-require-module index.cjs

Import ESM with NodeJs 22


These features mark just the beginning of what’s possible with the latest updates in Node.js from versions 18 to 22. To dive deeper and see these features in action, check out the modern-nodejs-2024 repository for hands-on examples.

For a more visual explanation and additional insights, watch my video on YouTube.

Cheers, and happy coding with the new Node.js features!