Skip to content
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

fix: properly calculate bytes of output size #82

Merged
merged 4 commits into from Jun 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -18,7 +18,7 @@
"lint": "eslint --ext .ts,.js .",
"prepack": "pnpm unbuild",
"release": "pnpm test && standard-version && git push --follow-tags && npm publish",
"stub": "pnpm unbuild -- --stub",
"stub": "pnpm unbuild --stub",
"test": "mocha -r jiti/register ./test/*.test.*",
"unbuild": "jiti ./src/cli"
},
Expand Down
2 changes: 1 addition & 1 deletion src/build.ts
Expand Up @@ -3,7 +3,7 @@ import { resolve, basename } from 'pathe'
import type { PackageJson } from 'pkg-types'
import chalk from 'chalk'
import consola from 'consola'
import defu from 'defu'
import { defu } from 'defu'
import { createHooks } from 'hookable'
import prettyBytes from 'pretty-bytes'
import mkdirp from 'mkdirp'
Expand Down
2 changes: 1 addition & 1 deletion src/builder/rollup.ts
Expand Up @@ -70,7 +70,7 @@ export async function rollupBuild (ctx: BuildContext) {
if (entry.isEntry) {
ctx.buildEntries.push({
path: relative(ctx.options.rootDir, resolve(outputOptions.dir!, entry.fileName)),
bytes: entry.code.length * 4,
bytes: Buffer.byteLength(entry.code, 'utf8'),
exports: entry.exports
})
}
Expand Down