Socket
Socket
Sign inDemoInstall

@jill64/adapter-cloudflare

Package Overview
Dependencies
225
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @jill64/adapter-cloudflare

🔌 SvelteKit Adapter for Cloudflare Pages with nodejs_compat


Version published
Maintainers
1
Install size
26.0 MB
Created

Readme

Source

@jill64/adapter-cloudflare

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

🔌 SvelteKit Adapter for Cloudflare Pages with nodejs_compat

[!IMPORTANT]

EOL

Node.js compatibility is currently available at @sveltejs/adapter-cloudflare@4.1.0

Old Documents

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.

License

MIT

Keywords

FAQs

Last updated on 07 Feb 2024

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc