|
@@ -71,7 +71,14 @@ for (const abs of files) {
|
|
|
const tpl = sfc.template || ''
|
|
const tpl = sfc.template || ''
|
|
|
if (tpl) {
|
|
if (tpl) {
|
|
|
const res = compiler.compile(tpl)
|
|
const res = compiler.compile(tpl)
|
|
|
- if (res.errors && res.errors.length) fail(rel, 'template', res.errors.join(' | '))
|
|
|
|
|
|
|
+ // tips 里也有会打断编译的:属性被切断会报 "outside root element will be ignored"
|
|
|
|
|
+ // (如 v-if="x.length > 0" 被脚本插入 :style 后 `> 0"` 甩到标签外),
|
|
|
|
|
+ // 它不属于 errors,只看 errors 会漏判。
|
|
|
|
|
+ const badTips = (res.tips || []).filter(t =>
|
|
|
|
|
+ /outside root element|duplicate attribute|exactly one root element/i.test(String(t))
|
|
|
|
|
+ )
|
|
|
|
|
+ const problems = [].concat(res.errors || [], badTips)
|
|
|
|
|
+ if (problems.length) fail(rel, 'template', problems.join(' | '))
|
|
|
else tplOk++
|
|
else tplOk++
|
|
|
} else tplOk++
|
|
} else tplOk++
|
|
|
}
|
|
}
|