Skip to content

Commit

Permalink
Callout --minify when script size is too large (#4201)
Browse files Browse the repository at this point in the history
  • Loading branch information
penalosa committed Oct 24, 2023
1 parent 1231a2b commit 0cac2c4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/bright-boxes-admire.md
@@ -0,0 +1,5 @@
---
"wrangler": minor
---

Callout `--minify` when script size is too large
2 changes: 1 addition & 1 deletion packages/wrangler/src/__tests__/deploy.test.ts
Expand Up @@ -8011,7 +8011,7 @@ export default{
"err": "",
"info": "",
"out": "Total Upload: xx KiB / gzip: xx KiB",
"warn": "[33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1mWe recommend keeping your script less than 1MiB (1024 KiB) after gzip. Exceeding past this can affect cold start time[0m
"warn": "[33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1mWe recommend keeping your script less than 1MiB (1024 KiB) after gzip. Exceeding this can affect cold start time. Consider using Wrangler's \`--minify\` option to reduce your bundle size.[0m
",
}
Expand Down
2 changes: 1 addition & 1 deletion packages/wrangler/src/deployment-bundle/bundle-reporter.ts
Expand Up @@ -43,7 +43,7 @@ export async function printBundleSize(

if (gzipSize > ALLOWED_INITIAL_MAX && !process.env.NO_SCRIPT_SIZE_WARNING) {
logger.warn(
"We recommend keeping your script less than 1MiB (1024 KiB) after gzip. Exceeding past this can affect cold start time"
"We recommend keeping your script less than 1MiB (1024 KiB) after gzip. Exceeding this can affect cold start time. Consider using Wrangler's `--minify` option to reduce your bundle size."
);
}
}
Expand Down

0 comments on commit 0cac2c4

Please sign in to comment.