]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
build: fix build script
authorEvan You <yyx990803@gmail.com>
Thu, 26 Jan 2023 08:11:24 +0000 (16:11 +0800)
committerEvan You <yyx990803@gmail.com>
Thu, 26 Jan 2023 08:11:24 +0000 (16:11 +0800)
scripts/build.mjs

index 29938294f0ac94265b29546b8a47ab0f3b523509..090995fc912dd294620a04d1ba0d9895d5253bc9 100644 (file)
@@ -91,7 +91,7 @@ async function build(target) {
   }
 
   // if building a specific format, do not remove dist.
-  if (!formats) {
+  if (!formats && existsSync(`${pkgDir}/dist`)) {
     await fs.rm(`${pkgDir}/dist`, { recursive: true })
   }
 
@@ -192,7 +192,7 @@ function checkFileSize(filePath) {
   const gzipped = gzipSync(file)
   const gzippedSize = (gzipped.length / 1024).toFixed(2) + 'kb'
   const compressed = compress(file)
-  const compressedSize = (compressed.length / 1024).toFixed(2) + 'kb'
+  const compressedSize = (compressed?.length || 0 / 1024).toFixed(2) + 'kb'
   console.log(
     `${chalk.gray(
       chalk.bold(path.basename(filePath))