Registry / devops / sketch-polyfill-fetch

sketch-polyfill-fetch

JSON →
library0.5.2jsnpmunverified

A fetch polyfill for Sketch plugins, version 0.5.2 (latest). Provides a lightweight fetch API implementation inspired by unfetch, specifically for use within Sketch plugin contexts. It is automatically included when using the skpm build tool, but can be installed separately. Only supports HTTPS due to macOS limitations. No active development or releases since 2018.

npm install sketch-polyfill-fetch
INSTALL
IMPORT
SIG · SKETCH-POLYFILL-FE
S
sketch-polyfill-fetch
devopsjavascriptv0.5.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 'sketch-polyfill-fetch'
const fetch = require('sketch-polyfill-fetch')
ESM default import is recommended when using skpm; CommonJS require also works but is the skpm-less pattern.
fetch
const fetch = require('sketch-polyfill-fetch')
CommonJS require is used without skpm; the package exports a single default function.
Headers
import { Headers } from 'sketch-polyfill-fetch'
Named exports for Headers, Request, Response are also available for polyfill completeness.

Shows how to use the fetch polyfill in a Sketch plugin with skpm, making an HTTPS GET request.

import fetch from 'sketch-polyfill-fetch'; export default function() { fetch('https://jsonplaceholder.typicode.com/todos/1') .then(response => response.json()) .then(data => console.log(data)) .catch(err => console.error(err)); }
Debug
Known issues
gotchaOnly HTTPS URLs are supported due to macOS limitations in Sketch; HTTP requests will fail.
fix
Always use https:// URLs in fetch calls.
affects: >=0.0.0
deprecatedThe package is deprecated; fetch is natively available in newer Sketch versions (>=71).
fix
If targeting Sketch 71+, remove the polyfill and use native fetch.
affects: >=0.0.0
Errors
Common errors & fixes
Network request failed
Using http:// URL instead of https://
fix
Change URL to https://
fetch is not defined
Missing import or using without skpm in a non-global context
fix
Add import fetch from 'sketch-polyfill-fetch' or const fetch = require('sketch-polyfill-fetch')
Upgrade
Version history
0.5.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
sketch-polyfill-fetch — npm install sketch-polyfill-fetch · libregistry