From 10fe226d0a7014c857fd30d566f9a250f9a3dff1 Mon Sep 17 00:00:00 2001 From: yutent Date: Thu, 23 Mar 2023 14:34:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=97=A5=E5=BF=97=E6=B8=85?= =?UTF-8?q?=E7=90=86=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/main.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/main.js b/lib/main.js index ede1a1e..ed97c7d 100644 --- a/lib/main.js +++ b/lib/main.js @@ -21,6 +21,7 @@ export default function compile(root = '', isProd = false, es) { if (isProd) { fs.rm(DIST_DIR, true) } + let ready = false chokidar .watch(SOURCE_DIR) @@ -28,6 +29,10 @@ export default function compile(root = '', isProd = false, es) { let file = filePath.slice(SOURCE_DIR.length) let target = join(DIST_DIR, file) + if (ready) { + console.clear() + } + if (act === 'add' || act === 'change') { let ext = file.slice(file.lastIndexOf('.') + 1) @@ -65,6 +70,8 @@ export default function compile(root = '', isProd = false, es) { } }) .on('ready', () => { + console.clear() + ready = true if (isProd) { process.exit() }