From 03ace216e446a3731e9d71da300ee8e761b43e85 Mon Sep 17 00:00:00 2001 From: yutent Date: Tue, 21 Feb 2023 21:27:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96404=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/dev.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/dev.js b/lib/dev.js index 6567d86..599a288 100644 --- a/lib/dev.js +++ b/lib/dev.js @@ -138,8 +138,6 @@ export default async function createServer(root = '', conf = {}) { DEPLOY_PATH }) - // console.log(entry); - code = parseHtml(html, { page, imports: conf.imports, entry }) } @@ -156,7 +154,6 @@ export default async function createServer(root = '', conf = {}) { file = join(SOURCE_DIR, rpath) } if (!fs.isfile(file)) { - console.clear() console.log(cyan(rpath), red(`not found!!!`)) console.log( red( @@ -164,6 +161,9 @@ export default async function createServer(root = '', conf = {}) { ), blue('/index.vue') ) + res.writeHead(404, 'Not Found') + res.end('') + return } code = compileVue(file, conf.imports, { @@ -207,7 +207,6 @@ export default async function createServer(root = '', conf = {}) { } else if (fs.isfile(join(PUBLIC_DIR, pathname))) { code = fs.cat(join(PUBLIC_DIR, pathname)) } else { - console.clear() console.log(cyan(pathname), red(`not found!!!`)) console.log( red( @@ -215,6 +214,9 @@ export default async function createServer(root = '', conf = {}) { ), blue('/index.js') ) + res.writeHead(404, 'Not Found') + res.end('') + return } code = parseJs(code + '', conf.imports, { IS_MPA, @@ -237,7 +239,6 @@ export default async function createServer(root = '', conf = {}) { code = null } if (code === null) { - console.clear() console.log(cyan(pathname), red(`not found!!!`)) res.writeHead(404, 'Not Found') res.end('')