Security News
JavaScript Leaders Demand Oracle Release the JavaScript Trademark
In an open letter, JavaScript community leaders urge Oracle to give up the JavaScript trademark, arguing that it has been effectively abandoned through nonuse.
@sveltejs/adapter-cloudflare
Advanced tools
[Adapter](https://kit.svelte.dev/docs#adapters) for building SvelteKit applications on Cloudflare Pages with Workers integration.
Adapter for building SvelteKit applications on Cloudflare Pages with Workers integration.
Comparisons
adapter-cloudflare
– supports all SvelteKit features; builds for
Cloudflare Pagesadapter-cloudflare-workers
– supports all SvelteKit features; builds for
Cloudflare Workersadapter-static
– only produces client-side static assets; compatible with
Cloudflare PagesNote: Cloudflare Pages' new Workers integration is currently in beta.
Compared toadapter-cloudflare-workers
, this adapter will be the preferred approach for most users since building on top of Pages unlocks automatic builds and deploys, preview deployments, instant rollbacks, etc.
From SvelteKit's perspective, there is no difference and no functionality loss when migrating to/from the Workers and the Pages adapters.
$ npm i --save-dev @sveltejs/adapter-cloudflare@next
You can include these changes in your svelte.config.js
configuration file:
import cloudflare from '@sveltejs/adapter-cloudflare';
export default {
kit: {
target: '#svelte',
adapter: cloudflare({
// any esbuild options
})
}
};
The adapter optionally accepts all
esbuild.build
configuration.
These are the default options, of which, all but target
and platform
are
enforced:
target: 'es2020',
platform: 'browser',
entryPoints: '< input >',
outfile: '<output>/_worker.js',
allowOverwrite: true,
format: 'esm',
bundle: true,
Please follow the Get Started Guide for Cloudflare Pages to begin.
When configuring your project settings, you must use the following settings:
npm run build
or svelte-kit build
.svelte-kit/cloudflare
NODE_VERSION
: 16
or 14
Important: You need to add a
NODE_VERSION
environment variable to both the "production" and "preview" environments. You can add this during project setup or later in the Pages project settings. SvelteKit requires Node14.13
or later, so you should use14
or16
as theNODE_VERSION
value.
FAQs
Adapter for building SvelteKit applications on Cloudflare Pages with Workers integration
The npm package @sveltejs/adapter-cloudflare receives a total of 37,918 weekly downloads. As such, @sveltejs/adapter-cloudflare popularity was classified as popular.
We found that @sveltejs/adapter-cloudflare demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
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.
Security News
In an open letter, JavaScript community leaders urge Oracle to give up the JavaScript trademark, arguing that it has been effectively abandoned through nonuse.
Security News
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.