Cloudflare Project fails to build if a previously build output is in the `.sveltekit` folder
A pull request for this has already been merged.
- #1098 by @teemingc — merged
- Dominant language
- TypeScript
- Stars
- 506
- Forks
- 107
- Avg merge
- 5d 15h
- Merged PRs (30d)
- 28
Description
Since we do wrangler types --check before building when a cloudflare project is built locally the wrangler types generation changes if the .sveltekit folder has the build output inside.
BEFORE BUILD
/* eslint-disable */
// Generated by Wrangler by running `wrangler types` (hash: 4f9fe9ddb2ea1e2c41e1be5910da8551)
// Runtime types generated with workerd@1.20260518.1 2026-05-20 nodejs_als
interface __BaseEnv_Env {
ASSETS: Fetcher;
}
declare namespace Cloudflare {
interface Env extends __BaseEnv_Env {}
}
interface Env extends __BaseEnv_Env {}
// Begin runtime types
/*! *****************************************************************************
Copyright (c) Cloudflare. All rights reserved.
Copyright (c) Microsoft Corporation. All rights reserved.
AFTER BUILD
/* eslint-disable */
// Generated by Wrangler by running `wrangler types` (hash: c2abdaaa333fde981ecf28696abe73c4)
// Runtime types generated with workerd@1.20260518.1 2026-05-20 nodejs_als
interface __BaseEnv_Env {
ASSETS: Fetcher;
}
declare namespace Cloudflare {
interface GlobalProps {
mainModule: typeof import("./.svelte-kit/cloudflare/_worker");
}
interface Env extends __BaseEnv_Env {}
}
interface Env extends __BaseEnv_Env {}
// Begin runtime types
/*! *****************************************************************************
Copyright (c) Cloudflare. All rights reserved.
Copyright (c) Microsoft Corporation. All rights reserved.
as you can see there's this extra part
/* eslint-disable */
// Generated by Wrangler by running `wrangler types` (hash: c2abdaaa333fde981ecf28696abe73c4)
// Runtime types generated with workerd@1.20260518.1 2026-05-20 nodejs_als
interface __BaseEnv_Env {
ASSETS: Fetcher;
}
declare namespace Cloudflare {
+ interface GlobalProps {
+ mainModule: typeof import("./.svelte-kit/cloudflare/_worker");
+ }
interface Env extends __BaseEnv_Env {}
}
interface Env extends __BaseEnv_Env {}
// Begin runtime types
/*! *****************************************************************************
Copyright (c) Cloudflare. All rights reserved.
Copyright (c) Microsoft Corporation. All rights reserved.
Since --check runs the generation and checks with the old one this means that
pnpm gen
pnpm build
pnpm build
will result in the second build to fail.
Even worse, if you regenerate the types and then push the build will break the deployment because the build output will not be present.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue in a Cloudflare project with pnpm gen, two successive pnpm build runs, and a deployment after regenerating types. Inspect the build flow around wrangler types --check and the .sveltekit output; done means repeated builds and deployment no longer depend on generated output already being present.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- build-system, cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100