Socket
Socket
Sign inDemoInstall

@jill64/adapter-cloudflare

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jill64/adapter-cloudflare

🔌 SvelteKit Adapter for Cloudflare Pages with nodejs_compat


Version published
Weekly downloads
1
decreased by-75%
Maintainers
1
Weekly downloads
 
Created
Source

adapter-cloudflare

npm-version npm-license npm-download-month npm-min-size ci.yml

🔌 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

  1. Add the adapter to your project. Adapter options are compatible with @sveltejs/adapter-cloudflare.
// svelte.config.js
import adapter from '@jill64/adapter-cloudflare'

export default {
  kit: {
    adapter: adapter({
      /* @sveltejs/adapter-cloudflare options */
      // routes: {
      //   // ...
      // }
    })
  }
}

If you need a node module that is not officially supported, add a polyfill with the following options based on esbuild-plugin-polyfill-node.

// svelte.config.js
import adapter from '@jill64/adapter-cloudflare'

export default {
  kit: {
    adapter: adapter({
      // /* esbuild-plugin-polyfill-node options */
      // globals: {
      //   // ...
      // },
      // polyfills: {
      //   // ...
      // }
    })
  }
}
  1. Enable Node.js compatibility in Cloudflare Pages.

    1. Go to Pages project page.
    2. Click the "Settings" => "Functions".
    3. Add nodejs_compat to the Compatibility flags.
  2. Deploy your project.

Keywords

FAQs

Package last updated on 06 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc