@sanity/client compatibility with JS runtimes

You should be able to use @sanity/client from any runtime, including Cloudflare Workers, Deno, Bun, and more.

StatusNameRuntimeEntryConditions
Bun v0.1bunexports.workerbrowser, bun, import, module, worker, worker.browser
Cloudflare Workercloudflare-workerexports.workerbrowser, import, worker, worker.browser
Cloudflare Worker Node compatibility modecloudflare-workerexports.workerbrowser, import, worker, worker.browser
Deno v1 Node compatibility modedenoexports.node.denodeno, import, node, node.deno, node.import
Deno v1 Packages from CDNdenoexports.workerbrowser, deno, import, module, worker, worker.browser, worker.node
Next.js Edge Functionvercel-edgeexports.browserbrowser, import, module, webpack
Next.js Serverless Functionnodeexports.node.import+exports.node.requireimport, node, node.deno, node.import
Node.js CJS v10nodemain.cjs + main.entry.cjs
Node.js CJS v12nodeexports.node.requirenode, node.require, require
Node.js CJS v14nodeexports.node.requirenode, node.require, require
Node.js CJS v16nodeexports.node.requirenode, node.require, require
Node.js CJS v18nodeexports.node.requirenode, node.require, require
Node.js ESM v14nodeexports.node.import+exports.node.requireimport, node, node.deno, node.import
Node.js ESM v16nodeexports.node.import+exports.node.requireimport, node, node.deno, node.import
Node.js ESM v18nodeexports.node.import+exports.node.requireimport, node, node.deno, node.import
Vercel Edge Functionvercel-edgemodule.js + module.entry.cjs
Vercel Serverless Functionnodeexports.node.requirenode, node.require, require