diff --git a/lib/compile-vue.js b/lib/compile-vue.js index 3fae656..ca0927f 100644 --- a/lib/compile-vue.js +++ b/lib/compile-vue.js @@ -112,7 +112,7 @@ export function parseJs( imports, { IS_MPA, currentPage, IS_ENTRY, DEPLOY_PATH, LEGACY_MODE } = {}, filename, - linePatch = 0 + linePatch = 1 ) { let fixedStyle = '' let ASSETS_DIR = '/@/' diff --git a/lib/dev.js b/lib/dev.js index 2ab47dd..1bc2b4b 100644 --- a/lib/dev.js +++ b/lib/dev.js @@ -166,13 +166,18 @@ export default async function createServer(root = '', conf = {}) { let entry = fs.cat(page.entry)?.toString() let html = fs.cat(join(process.cwd(), 'index.html')).toString() - entry = parseJs(entry, conf.imports, { - IS_MPA, - currentPage, - IS_ENTRY: true, - DEPLOY_PATH, - LEGACY_MODE - }) + entry = parseJs( + entry, + conf.imports, + { + IS_MPA, + currentPage, + IS_ENTRY: true, + DEPLOY_PATH, + LEGACY_MODE + }, + page.entry + ) code = parseHtml(html, { page, @@ -198,7 +203,6 @@ export default async function createServer(root = '', conf = {}) { file = join(SOURCE_DIR, rpath) } } else { - ndex.html file = join(SOURCE_DIR, rpath) } if (!fs.isfile(file)) { @@ -267,19 +271,25 @@ export default async function createServer(root = '', conf = {}) { if (fs.isfile(file)) { code = fs.cat(file) } else if (fs.isfile(join(PUBLIC_DIR, rpath))) { - code = fs.cat(join(PUBLIC_DIR, rpath)) + file = join(PUBLIC_DIR, rpath) + code = fs.cat(file) } else { friendlyErrors(rpath, ext) res.writeHead(404, USE_HTTPS ? void 0 : 'Not Found') res.end('') return } - code = parseJs(code + '', conf.imports, { - IS_MPA, - currentPage, - DEPLOY_PATH, - LEGACY_MODE - }) + code = parseJs( + code + '', + conf.imports, + { + IS_MPA, + currentPage, + DEPLOY_PATH, + LEGACY_MODE + }, + file + ) res.setHeader('content-type', MIME_TYPES.js) }