-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
chore: use "kB" everywhere with the correct definition #14061
Conversation
Run & review this pull request in StackBlitz Codeflow. |
@@ -329,10 +329,10 @@ function bundleSizeLimit(limit: number): Plugin { | |||
.join(''), | |||
'utf-8', | |||
) | |||
const kb = size / 1024 | |||
const kb = size / 1000 |
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 this change triggered the limit 😅
packages/vite build: [!] (plugin bundle-limit) Error: Bundle size exceeded 120 kB, current size is 121.86kb.
packages/vite build: at Object.generateBundle (file:///home/runner/work/vite/vite/packages/vite/rollup.config-1691641081524.mjs:360:23)
packages/vite build: at /home/runner/work/vite/vite/node_modules/.pnpm/rollup@3.28.0/node_modules/rollup/dist/shared/rollup.js:1909:40
packages/vite build: ELIFECYCLE Command failed with exit code 1.
packages/vite build: ERROR: "build-bundle" exited with 1.
packages/vite build: Failed
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.
e235780
to
3b4904f
Compare
It seems we are using 4KiB as a default value for vite/packages/vite/src/node/build.ts Lines 108 to 113 in 2c1a45c
I guess it's better to keep the value as-is to avoid the breaking change, and correct the 4kB comment to 4KiB .
|
@sapphi-red, thanks, I missed that pattern. I now ran |
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.
Thanks!
Recently I got confused with inconsistent usages across tools around "Kilobyte".
And then I just found Vite chose to use "kB = 1000 bytes" in #10982.
This PR is just to fix small remaining inconsistencies.
I searched these using
ripgrep
by runningrg --hidden -i -w kb
andrg --hidden -i -w kib
Changes in this PR should not affect the behavior of Vite itself