feat: Cloudflare Vite plugin integration#15627
Conversation
This reverts commit eaffa39.
🦋 Changeset detectedLatest commit: 8970286 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
|
Do we have any timeline on this one? |
|
The team is currently focusing on Svelte async bugs, regressions, security fixes, and remote functions. Even if this were merged, it would have to wait until the whole of SvelteKit 3 is ready before release |
| await expect(page.locator('#var')).toHaveText(`Var: ${prod_string}VAR`); | ||
| }); | ||
|
|
||
| test('serves static assets with assets path prefix', async ({ page, request }) => { |
There was a problem hiding this comment.
Not really sure how to get this test passing in the Cloudflare environment. Vite doesn't enforce consumers to allow us to run arbitrary code during preview so an alternative might be to have process.env.SVELTEKIT_ASSETS as an override which we set before anything else starts?
…1 (steps 1-3) Steps 1-3 of docs/jazz-to-cloudflare-migration.md: - Provision D1 + per-show ShowRoom and singleton ShowDirectory Durable Object bindings in wrangler.jsonc; generate binding types (pnpm cf:types). - Switch SvelteKit to @sveltejs/adapter-cloudflare. Because the released adapter (pre sveltejs/kit#15627) writes its worker to wrangler's `main`, a second config (wrangler.adapter.jsonc) drives the adapter's output while the real wrangler.jsonc `main` is src/worker.ts — a custom entry that imports the built SvelteKit worker, re-exports the Durable Objects, and wraps fetch with @sentry/cloudflare. - Port server Sentry to @sentry/cloudflare; delete instrumentation.server.ts and the adapter-node tracing/instrumentation settings. - Move Better Auth off jazzAdapter to a per-request createAuth(env) factory using the Drizzle / drizzle-orm/d1 adapter. Hand-authored D1 schema (auth tables + registry: shows/showHosts/hostLinks) with a partial unique index enforcing one live show. drizzle-kit migrations applied to local D1. - DEV_AUTH-gated dev-auth bypass (/dev-login) seeding an admin and a viewer, minting real JWKS-signed JWTs (verified: admin is_admin:true, viewer false). - Repoint auth:schema/db:reset; drop auth:validate. Add cf:types/db:* scripts. Deviations (documented): raw Durable Objects + WebSocket Hibernation API instead of PartyServer; wrangler dev against the build is the DO-capable runtime loop instead of @cloudflare/vite-plugin's vite dev, which cannot run a custom DO-exporting worker entry with the current SvelteKit adapter. Jazz data path goes dark mid-migration (single branch, no dual-path), restored on the new stack in steps 4-5. check/lint/build all green; app + auth verified under wrangler dev via Chrome DevTools. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Links the two live upstream tracks: sveltejs/kit#15627 (adapter-cloudflare adopting @cloudflare/vite-plugin) and the Durable Object / Workflow export gap in cloudflare/workers-sdk#14013. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
tested this PR against a real production app: SvelteKit + a Durable Object (voice agent) exported from the same Worker, WebSockets, Workers AI with Setup: installed via Findings, in the order we hit them:
Happy to re-test on this app as the PR evolves; it exercises pretty much everything at once (DO + WebSockets + remote AI bindings + custom entrypoint), so it's a decent canary. |
closes #10496
closes #13692
closes #1712
closes #2963
closes #13300
closes #1519
This PR removes support for Cloudflare Pages and integrates with the Cloudflare Vite plugin. Users can now:
TODOs
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm testand lint the project withpnpm lintandpnpm checkChangesets
pnpm changesetand following the prompts. Changesets that add features should beminorand those that fix bugs should bepatch. Please prefix changeset messages withfeat:,fix:, orchore:.Edits