Skip to content

Commit

Permalink
The 10MB issue is a different feature/problem
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobMGEvans committed Sep 15, 2023
1 parent b86c715 commit db58d6e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/wrangler/src/deployment-bundle/bundle-reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type { CfModule } from "./worker";
import type { Metafile } from "esbuild";

const ONE_KIB_BYTES = 1024;
const ALLOWED_MAX_SIZE = ONE_KIB_BYTES * ONE_KIB_BYTES * 10; // Current max is 10 MiB
const ALLOWED_INITIAL_MAX = ONE_KIB_BYTES * 1024; // Current max is 1 MiB

async function getSize(modules: CfModule[]) {
const gzipSize = gzipSync(
Expand All @@ -30,7 +30,7 @@ export async function printBundleSize(
gzipSize / ONE_KIB_BYTES
).toFixed(2)} KiB`;

const percentage = (gzipSize / ALLOWED_MAX_SIZE) * 100;
const percentage = (gzipSize / ALLOWED_INITIAL_MAX) * 100;

const colorizedReport =
percentage > 90
Expand All @@ -41,9 +41,9 @@ export async function printBundleSize(

logger.log(`Total Upload: ${colorizedReport}`);

if (gzipSize > ALLOWED_MAX_SIZE && !process.env.NO_SCRIPT_SIZE_WARNING) {
if (gzipSize > ALLOWED_INITIAL_MAX && !process.env.NO_SCRIPT_SIZE_WARNING) {
logger.warn(
"We recommend keeping your script less than 10MiB (10240 KiB) after gzip. Exceeding past this can affect cold start time"
"We recommend keeping your script less than 1MiB (1024 KiB) after gzip. Exceeding past this can affect cold start time"
);
}
}
Expand Down

0 comments on commit db58d6e

Please sign in to comment.