-
Notifications
You must be signed in to change notification settings - Fork 786
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
Colorize Deployed Bundle Size #3928
Conversation
Most bundlers, and other tooling that give you size outputs will colorize their the text to indicate if the value is within certain ranges.
🦋 Changeset detectedLatest commit: db58d6e The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
Codecov Report
@@ Coverage Diff @@
## main #3928 +/- ##
==========================================
+ Coverage 75.10% 75.13% +0.02%
==========================================
Files 195 195
Lines 11487 11533 +46
Branches 3036 3054 +18
==========================================
+ Hits 8627 8665 +38
- Misses 2860 2868 +8
|
@@ -29,7 +30,16 @@ export async function printBundleSize( | |||
gzipSize / ONE_KIB_BYTES | |||
).toFixed(2)} KiB`; | |||
|
|||
logger.log(`Total Upload: ${bundleReport}`); | |||
const percentage = (gzipSize / ONE_MIB_BYTES) * 100; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the limit is 10MB now? https://developers.cloudflare.com/workers/platform/limits/#worker-size
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh dang! I can change that for this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Annoyingly it's different for free/paid accounts, and there's not any easy way to tell which limit we should show
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh gawd...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be safer to keep it at 1Mib? Any size over that will become purged from edge colos a lot more quickly when it's not been recently requested, in comparison to smaller scripts, so it's definitely the maximum script size to aim for
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could the deploy API report the maximum allowed worker size in a response header? Presumably it has access to it so it can restrict uploads. We could then use that for future upload requests in the session, or wait until after the request completed to log the request size?
…t adjustment to the PR
A wrangler prerelease is available for testing. You can install this latest build in your project with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/6200946190/npm-package-wrangler-3928 You can reference the automatically updated head of this PR with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/6200946190/npm-package-wrangler-3928 Or you can use npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/6200946190/npm-package-wrangler-3928 dev path/to/script.js Additional artifacts:npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/6200946190/npm-package-cloudflare-pages-shared-3928 Note that these links will no longer work once the GitHub Actions artifact expires.
| Please ensure constraints are pinned, and |
Most bundlers, and other tooling that give you size outputs will colorize their the text to indicate if the value is within certain ranges.
Fixes #1312