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.
Since we do
wrangler types --checkbefore building when a cloudflare project is built locally thewrangler typesgeneration changes if the.sveltekitfolder has the build output inside.BEFORE BUILD
AFTER BUILD
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
--checkruns the generation and checks with the old one this means thatwill 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.