Skip to content

Commit 681775a

Browse files
committed
build: fix build script
1 parent 3db69af commit 681775a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

scripts/build.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ async function build(target) {
9191
}
9292

9393
// if building a specific format, do not remove dist.
94-
if (!formats) {
94+
if (!formats && existsSync(`${pkgDir}/dist`)) {
9595
await fs.rm(`${pkgDir}/dist`, { recursive: true })
9696
}
9797

@@ -192,7 +192,7 @@ function checkFileSize(filePath) {
192192
const gzipped = gzipSync(file)
193193
const gzippedSize = (gzipped.length / 1024).toFixed(2) + 'kb'
194194
const compressed = compress(file)
195-
const compressedSize = (compressed.length / 1024).toFixed(2) + 'kb'
195+
const compressedSize = (compressed?.length || 0 / 1024).toFixed(2) + 'kb'
196196
console.log(
197197
`${chalk.gray(
198198
chalk.bold(path.basename(filePath))

0 commit comments

Comments
 (0)