adapter-cloudflare

🔌 SvelteKit Adapter for Cloudflare Pages with nodejs_compat
This adapter is based on Node.js compatibility and allows some node modules to be used with Cloudflare Pages.
Installation
npm i -D @jill64/adapter-cloudflare
Usage
- Add the adapter to your project.
Adapter options are compatible with @sveltejs/adapter-cloudflare.
import adapter from '@jill64/adapter-cloudflare'
export default {
kit: {
adapter: adapter({
})
}
}
If you need a node module that is not officially supported, add a polyfill with the following options based on esbuild-plugin-polyfill-node.
import adapter from '@jill64/adapter-cloudflare'
export default {
kit: {
adapter: adapter({
})
}
}
-
Enable Node.js compatibility in Cloudflare Pages.
- Go to Pages project page.
- Click the "Settings" => "Functions".
- Add
nodejs_compat
to the Compatibility flags.
-
Deploy your project.