Registry / devops / just-use-native-fetch

just-use-native-fetch

JSON →
library1.0.0jsnpmunverified

A tiny utility package (v1.0.0, no release cadence) that provides an alias for node-fetch, redirecting to the native fetch API available in Node.js 18+ and modern browsers. It avoids unnecessary polyfills and simplifies configuration in Vite projects. Differentiator: minimal alternative to node-fetch for environments where native fetch is sufficient.

npm install just-use-native-fetch
INSTALL
IMPORT
SIG · JUST-USE-NATIVE-FE
J
just-use-native-fetch
devopsjavascriptv1.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default export
import fetch from 'just-use-native-fetch'
const fetch = require('just-use-native-fetch')
ESM-only package; CommonJS require not supported.
fetch function
import fetch from 'just-use-native-fetch'
Directly exports the native fetch function.
Headers class
import { Headers } from 'just-use-native-fetch'
import { Headers } from 'node-fetch'
Also exports native Headers, Request, Response for convenience.

Shows how to alias node-fetch to use native fetch in Vite, then use fetch normally.

// vite.config.js import { defineConfig } from 'vite'; export default defineConfig({ resolve: { alias: { 'node-fetch': 'just-use-native-fetch', }, }, }); // Then in your code import fetch from 'node-fetch'; const response = await fetch('https://api.example.com/data'); const data = await response.json(); console.log(data);
Debug
Known issues
breakingNode.js 18+ required; native fetch not available in older Node versions.
fix
Upgrade Node.js to 18+ or use a real polyfill like node-fetch.
affects: <18.0.0
gotchaThis package is not a drop-in replacement if you rely on node-fetch-specific options like 'compress' or 'highWaterMark'.
fix
Use node-fetch directly or check compatibility of your fetch options with native fetch.
affects: >=1.0.0
gotchaThis package only works in browser or Node.js 18+; not compatible with Deno or other runtimes out of the box.
fix
Use only in supported environments.
affects: >=1.0.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/node_modules/just-use-native-fetch/index.js not supported.
Trying to require the package in a CommonJS context.
fix
Use dynamic import() or switch to ESM: add 'type': 'module' in package.json or use .mjs extension.
fetch is not defined
Running on Node.js <18 or an older browser that doesn't support native fetch.
fix
Upgrade Node.js to 18+ or polyfill with node-fetch. Ensure you are not using this package in unsupported environments.
Cannot find module 'just-use-native-fetch'
Package not installed or alias incorrectly configured in Vite.
fix
Run npm install just-use-native-fetch and double-check the resolve alias in vite.config.js.
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
3 hits · last 30 days
node
2
Amazon
1
Resources
just-use-native-fetch — npm install just-use-native-fetch · libregistry