-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
feat: support Cloudflare Workers Builds #13733
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 710510b The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 |
Co-authored-by: Ben McCann <[email protected]>
…ltejs/kit into feat-adapter-auto-workers-ci
@benmccann I'm not sure if the adapter-auto case for Workers Builds is very useful with this PR because it doesn't "just work" like the other platforms do (since it fails without a Wrangler config file). Would it be useful to generate a basic Wrangler config during the Workers CI so that it just works? Or is it better that users get a deployment error which forces them to setup a wrangler.jsonc file? |
Ah, I guess the PR description is outdated then as it suggests it works without a config What would a basic config contain? Is there anything we might accidentally omit or get wrong by doing that? |
Yeah, I was half-way implementing the generated config but then wasn't sure if it would be a good idea.
The minimum we would need would be: {
// `name` is not required since Cloudflare's dashboard requires the user to enter that before the build
"main": ".svelte-kit/cloudflare/_worker.js",
// this will be based on the current date
"compatibility_date": "2025-04-24",
"assets": {
"binding": "ASSETS",
"directory": ".svelte-kit/cloudflare",
},
// only required if the user uses `getRequestEvent()` asynchronously.
// Enabling this doesn't add any polyfills like `nodejs_compat` does so it could be safe to always have this?
// Otherwise we could only include it if we detect `getRequestEvent()` being used.
"compatibility_flags": ["nodejs_als"]
} Another question is: how should we generate the Wrangler config? There are currently two ways to do this:
|
Inspired by unjs/std-env#156
This PR detects the
WORKERS_CI
environment variable so thatadapter-auto
andadapter-cloudflare
can work with Cloudflare's Workers Git integration to build the appwithout requiring a wrangler configuration from the user.Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm test
and lint the project withpnpm lint
andpnpm check
Changesets
pnpm changeset
and following the prompts. Changesets that add features should beminor
and those that fix bugs should bepatch
. Please prefix changeset messages withfeat:
,fix:
, orchore:
.Edits