<!--
title: Native fetch over dependencies
domain: ai-agents
topic: API
language: Json
source: bytedance/UI-TARS-desktop
updated: 2025-08-13
url: https://awesomereviewers.com/reviewers/ui-tars-desktop-native-fetch-over-dependencies/
-->

Prefer Node.js native fetch API over external HTTP client libraries like `node-fetch` when the target Node.js version supports stable native functionality. While fetch is available from Node.js 18+, it's considered stable from version 21 onwards.

Before adding HTTP client dependencies, evaluate:
- Target Node.js version compatibility
- Native API stability requirements  
- Whether external dependencies provide necessary additional features

Example of unnecessary dependency:
```json
// Avoid when targeting Node.js >= 21
"dependencies": {
  "node-fetch": "3.3.2"  // Remove if native fetch suffices
}
```

This reduces bundle size, eliminates potential security vulnerabilities from external packages, and leverages platform-native optimizations. Only retain HTTP client libraries when they provide essential features not available in the native fetch API or when targeting older Node.js versions where native fetch is unstable.
