AI summary by TwinMind
NodeJS 22 Just Dropped, Here's Why I'm Hyped
Theo - t3․gg
14m 30s
Node 22 Release Overview
- Node v22 now available, not massive release but contains subtle important features
- Will enter LTS (long-term support) in October 2024
- Current release for next 6 months until LTS transition
- Node 18 maintained until April 2025, Node 20 still active LTS
- Node 21 (non-LTS) maintenance ending in May/June
Infrastructure Adoption Timeline
- Lambda/Vercel deployment limitations - can't use Node 22 immediately
- Lambda only started supporting Node 20 in November 2023 (5 months after release)
- Node 22 planned for Lambda in November 2024
- Historical delays in cloud provider adoption
- Performance wins from Node 20 cold starts were significant
Windows ARM Support
- First Windows ARM 64-bit build now available
- Node.js among first to support Windows on ARM architecture
V8 JavaScript Engine Update to 12.4
- Major version behind previous Node 20 V8 version
- New JavaScript features:
- Array.fromAsync()
- Set methods
- Iterator helpers
- New Maglev JIT compiler enabled by default
- Improves performance for short-lived CLI programs
- Faster execution, less memory usage
- Significant performance boost for quick CLI tools
ESM (ES Modules) Support Enhancement
- Require support for synchronous ESM graphs via
--experimental-require-moduleflag - Requirements for ESM packages:
- Must be explicitly marked as ES module with "type": "module" in package.json
- Must be fully synchronous (no top-level await)
- Can now ship ESM-only packages that work with require()
- Plans to enable by default in future (no flag required)
- Major step toward killing CommonJS (CJS)
Package.json Script Execution
- New
node --runcommand for executing package.json scripts - Also supports
node --run test - Performance improvement over npm run:
- npm run test: ~212ms
- node run test: ~33ms
- 200ms+ performance difference
- Addresses slow npm run script execution
Stream Performance Improvements
- Default high water mark increased from 16KB to 64KB
- Performance boost across the board
- Slightly higher memory usage trade-off
- Explicit configuration available for memory-sensitive environments
- Benefits data streaming, internet requests, file operations
Watch Mode Stability
- Watch mode now considered stable (no longer experimental)
- Automatically restarts Node process when watched files change
- Historical context: Watchman (by Meta) was painful to set up
- Built-in file watching eliminates need for external tools
- Instant restart on file changes
- Demo showed immediate response to file saves
WebSocket Client Support
- Browser-compatible WebSocket implementation enabled by default
- Previously behind
--experimental-websocketflag - WebSocket client functionality (not server)
- No external dependencies required
- Based on undici (Node's HTTP implementation)
- Historical context: U WebSocket still recommended for servers
- 8.5x faster than Fastify
- 10x faster than socket.io
- Built into Bun, 80% faster than Bun's Node implementation
- Socket.io creator: Guillermo Rauch (also Next.js creator, Vercel CEO)
- Next.js recently surpassed socket.io in npm downloads
File System Glob Support
- New
glob()andglobSync()functions - Native glob pattern matching without external packages
- Example:
**/*.jsselects all JS files recursively - Returns arrays for iteration
- Eliminates dependency on glob packages
Performance Optimizations
- AbortSignal creation efficiency improvements
- Significant performance boost for fetch operations
- Enhanced test runner performance
- Overall faster HTTP operations in Node
Community Engagement
- Node.js team requesting community feedback via survey
- Seeking input on Node usage patterns and preferences
- Survey link provided for community participation
