From 5e6fc26bd30b22be78e10e7a7133980945b55da1 Mon Sep 17 00:00:00 2001 From: yutent Date: Fri, 14 Oct 2022 12:06:33 +0800 Subject: [PATCH] update --- lib/prod.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/prod.js b/lib/prod.js index e999bc7..0360f96 100644 --- a/lib/prod.js +++ b/lib/prod.js @@ -8,7 +8,7 @@ const noc = Buffer.from('') export default function compile(root = '', dist = '', conf = {}) { // const IS_MPA = Object.keys(conf.pages).length > 1 - + let timeStart = Date.now() let html = fs.cat(join(process.env.PWD, 'index.html')).toString() let pagesDir = '', @@ -26,6 +26,8 @@ export default function compile(root = '', dist = '', conf = {}) { currentPage = Object.keys(conf.pages)[0] page = conf.pages[currentPage] + console.log('正在生成 %s...', `${currentPage}.html`) + for (let it of list) { // 入口文件, 特殊处理 if (it.path === page.entry) { @@ -35,10 +37,11 @@ export default function compile(root = '', dist = '', conf = {}) { let code = parseHtml(html, { page, imports: conf.imports, entry }) fs.echo(code, join(dist, `${currentPage}.html`)) - continue } + console.log(' 解析 %s...', it.name) + switch (it.ext) { case '.vue': { @@ -80,7 +83,13 @@ export default function compile(root = '', dist = '', conf = {}) { fs.echo(code, join(dist, it.name)) } break + + default: + fs.cp(it.path, join(dist, it.name)) + break } } } + + console.log('\n页面处理完成, 耗时 %ss\n', (Date.now() - timeStart) / 1000) }