Skip to content

feat: build and preview Cloudflare Workers with the Vite plugin - #17480

Draft
teemingc wants to merge 26 commits into
teemingc-remove-cloudflare-pagesfrom
teemingc-cloudflare-vite-integration
Draft

teemingc wants to merge 26 commits into
teemingc-remove-cloudflare-pagesfrom
teemingc-cloudflare-vite-integration

Conversation

@teemingc

@teemingc teemingc commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

stacked on top of #17479

Integrates Cloudflare’s Vite plugin for Cloudflare Workers unbundled builds and vite preview running with workerd. It also rejects paths.assets configuration as you'd probably not use that with Cloudflare and there's no way to make it work with workerd. Custom workers will be added in a follow-up PR

teemingc and others added 7 commits October 16, 2026 17:43
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@pkg-svelte-dev

pkg-svelte-dev Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Install the latest version of @sveltejs/kit from a2b8ccc:

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

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

@changeset-bot

changeset-bot Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a2b8ccc

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

This PR includes changesets to release 2 packages
Name Type
@sveltejs/adapter-cloudflare Major
@sveltejs/kit Minor

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

@svelte-docs-bot

Copy link
Copy Markdown

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Comment thread documentation/docs/25-build-and-deploy/60-adapter-cloudflare.md Outdated
Comment thread documentation/docs/25-build-and-deploy/60-adapter-cloudflare.md Outdated
Comment thread documentation/docs/25-build-and-deploy/60-adapter-cloudflare.md Outdated
teemingc and others added 2 commits October 16, 2026 23:16
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Comment thread documentation/docs/25-build-and-deploy/60-adapter-cloudflare.md Outdated
@teemingc teemingc added breaking change needs-platform-tests This PR needs to run platform tests in order to merge. labels Oct 16, 2026
@teemingc
teemingc marked this pull request as draft October 16, 2026 13:39
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Comment thread packages/adapter-cloudflare/index.d.ts Outdated
Comment thread packages/kit/src/exports/public.d.ts Outdated
@teemingc

Copy link
Copy Markdown
Member Author

/autofix

Comment thread .changeset/better-houses-vanish.md Outdated
Comment thread documentation/docs/25-build-and-deploy/60-adapter-cloudflare.md Outdated
Comment thread documentation/docs/25-build-and-deploy/60-adapter-cloudflare.md Outdated
Comment thread documentation/docs/25-build-and-deploy/60-adapter-cloudflare.md Outdated
Co-authored-by: Tee Ming <chewteeming01@gmail.com>
Comment thread documentation/docs/25-build-and-deploy/60-adapter-cloudflare.md Outdated
Comment thread documentation/docs/25-build-and-deploy/60-adapter-cloudflare.md Outdated
Comment thread documentation/docs/25-build-and-deploy/60-adapter-cloudflare.md Outdated
Comment thread documentation/docs/25-build-and-deploy/60-adapter-cloudflare.md Outdated
Comment thread documentation/docs/25-build-and-deploy/60-adapter-cloudflare.md Outdated
teemingc and others added 3 commits October 17, 2026 00:34
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* @param {string} [root]
* @param {string} [mode]
*/
function read_config(root = process.cwd(), mode = 'production') {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only used

  • In the vite plugin only to validate
  • In adapt after building is finished

so we could just write to a local variable in the cloudflare plugin's config function instead of reimplementing the config loader

config(config, env) {
if (env.command !== 'build') return;
const wrangler_config = read_config(config.root, env.mode);
validate_worker_settings(wrangler_config);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to run validation twice

Comment thread packages/adapter-cloudflare/index.js
Comment thread packages/adapter-cloudflare/test/apps/workers/src/env.js
output_config.assets.directory = posixify(path.relative(worker_dir, assets));
fs.writeFileSync(`${worker_dir}/wrangler.json`, JSON.stringify(output_config, null, 2));

const deploy_config_path = path.join(vite_config.root, '.wrangler/deploy/config.json');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we confirm this path is static?

@teemingc
teemingc force-pushed the teemingc-remove-cloudflare-pages branch from 682173b to 7203124 Compare October 22, 2026 07:50

This branch has not been deployed

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

Labels

breaking change needs-platform-tests This PR needs to run platform tests in order to merge. pkg:adapter-cloudflare

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants