增加容错判断, 避免vscode保存时格式化插件抽风

pull/5/head
yutent 2023-06-21 19:06:55 +08:00
parent 1b3425196e
commit 3404c87a71
1 changed files with 1 additions and 1 deletions

View File

@ -289,7 +289,7 @@ export function compileVue(file, imports, options = {}) {
let js = code.match(JS_EXP) let js = code.match(JS_EXP)
let scss = [...code.matchAll(STYLE_EXP)] let scss = [...code.matchAll(STYLE_EXP)]
let html = code.match(HTML_EXP) || ['', ''] let html = code.match(HTML_EXP) || ['', '']
let linePatch = code.slice(0, js.index).split('\n').length // js起始行数修正 let linePatch = code.slice(0, js?.index || 0).split('\n').length // js起始行数修正
let hash = md5(file) let hash = md5(file)
let scopeId = 'data-' + hash let scopeId = 'data-' + hash