Registry / testing / ember-fetch

ember-fetch

JSON →
library8.1.2jsnpmunverified

An Ember addon that wraps the GitHub fetch polyfill for ember-cli apps. Provides a standards-compliant fetch implementation for browsers that lack native support, with optional fallback to native fetch when available. Version 8.1.2 is stable, actively maintained, and works with Ember 2.13+. Ships TypeScript declarations. Key differentiators: seamless integration with Ember's build pipeline, Fastboot support with automatic absolute URL resolution, optional native fetch bypass via build config, and support for AbortController. Ember Data 3.9.2+ includes built-in fetch; for older versions use v7.x.

npm install ember-fetch
INSTALL
IMPORT
SIG · EMBER-FETCH
E
ember-fetch
testingjavascriptv8.1.2
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.

fetch
import fetch from 'fetch';
import fetch from 'ember-fetch';
The import path is 'fetch', not 'ember-fetch'. This is the default export.
Headers
import { Headers } from 'fetch';
Named export from the 'fetch' module.
Request
import { Request } from 'fetch';
Named export from the 'fetch' module.
Response
import { Response } from 'fetch';
Named export from the 'fetch' module.
AbortController
import { AbortController } from 'fetch';
import 'abortcontroller-polyfill';
Available as named export from 'fetch' starting from version 8.0.0. No need for separate polyfill.

Shows basic usage: build config with preferNative, import fetch from 'fetch', and make a GET request.

// ember-cli-build.js let app = new EmberApp(defaults, { 'ember-fetch': { preferNative: true } }); // app/route.js import Route from '@ember/routing/route'; import fetch from 'fetch'; export default Route.extend({ model() { return fetch('/api/data.json') .then(response => response.json()) .then(data => data); } });
Debug
Known issues
breakingImport path changed from 'ember-fetch' to 'fetch' in version 8.0.0.
fix
Use import fetch from 'fetch' instead of 'ember-fetch'.
affects: >=8.0.0
gotchaRelative URLs require Fastboot initialization; initializers and app.js cannot use relative URLs.
fix
Use absolute URLs or ensure usage is after instance-initializers run.
affects: >=7.0.0
gotchaIn Fastboot, node-fetch does not support relative URLs by default. ember-fetch resolves them only after instance-initializers.
fix
Use absolute URLs or move fetch calls to after instance-initializers.
affects: >=7.0.0
deprecatedEmber Data below 3.9.2 does not support ember-fetch 8.x; use 7.x series.
fix
Pin ember-fetch to 7.x or upgrade Ember Data.
affects: <3.9.2
breakingAbortController support introduced in version 8.0.0; older versions require polyfill.
fix
Upgrade to 8.0.0 or use abortcontroller-polyfill separately.
affects: <8.0.0
Errors
Common errors & fixes
Cannot find module 'ember-fetch'
Importing from 'ember-fetch' instead of 'fetch' (v8+).
fix
Change import to import fetch from 'fetch';
fetch is not a function
In Fastboot, fetch not available before instance-initializers due to relative URL resolution logic.
fix
Ensure fetch calls happen after instance-initializers or use absolute URLs.
Only absolute URLs are supported
node-fetch limitation; ember-fetch resolves relative URLs only after Fastboot init.
fix
Use absolute URL or ensure fetch is called after instance-initializers.
ember-fetch is not a function
Trying to use ember-fetch as a function directly (old v7 pattern) with v8+.
fix
Use import fetch from 'fetch'; and call fetch() directly.
Upgrade
Version history
8.1.2latest on npm
Audit
Dependencies
node-fetchoptionalUsed in Fastboot environment where native fetch is not available
Agent activity
7 hits · last 30 days
node
6
Resources
ember-fetch — npm install ember-fetch · libregistry