Skip to content

fix: dispose Cloudflare platform proxy when Vite servers close - #16976

Draft
svelte-triage-bot[bot] wants to merge 1 commit into
version-3from
triage/kit-16919-dispose-cloudflare-proxy
Draft

fix: dispose Cloudflare platform proxy when Vite servers close#16976
svelte-triage-bot[bot] wants to merge 1 commit into
version-3from
triage/kit-16919-dispose-cloudflare-proxy

Conversation

@svelte-triage-bot

Copy link
Copy Markdown
Contributor

Closes #16919

The Cloudflare adapter no longer creates its platform proxy during builds, but the proxy created for Vite dev and preview servers was still retained after those servers closed.

This change retains the proxy in the adapter plugin and disposes it:

  • through Vite's awaited closeBundle lifecycle for dev servers
  • through the preview server's close() lifecycle
  • idempotently when multiple close hooks run
  • while clearing the global proxy so a later server can create a fresh instance

Added focused tests covering dev and preview teardown and a patch changeset.

Verification:

  • pnpm -F @sveltejs/adapter-cloudflare test:unit
  • pnpm -F @sveltejs/adapter-cloudflare check
  • pnpm -F @sveltejs/kit test:unit
  • pnpm check
  • pnpm lint
  • Cloudflare workers fixture build, with zero workerd processes before and after

@pkg-svelte-dev

Copy link
Copy Markdown

Install the latest version of @sveltejs/kit from 2c82e22:

pnpm add https://pkg.svelte.dev/@sveltejs/kit/c/2c82e227c6a8c7d40a3546f224e639ea7d940562

Open in pkg.svelte.dev: https://pkg.svelte.dev/repos/kit/pr/16976

Note

This PR is from a fork. A maintainer must approve approve each commit before it can be built and installed.

@changeset-bot

changeset-bot Bot commented Aug 28, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2c82e22

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sveltejs/adapter-cloudflare Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

emulate() never disposes the platform proxy, so every build leaks a workerd

0 participants