diff --git a/src/compiler/parser/html-parser.js b/src/compiler/parser/html-parser.js
index fabe264e5f6..087aef66970 100644
--- a/src/compiler/parser/html-parser.js
+++ b/src/compiler/parser/html-parser.js
@@ -123,7 +123,7 @@ export function parseHTML (html, options) {
}
let text, rest, next
- if (textEnd > 0) {
+ if (textEnd >= 0) {
rest = html.slice(textEnd)
while (
!endTag.test(rest) &&
diff --git a/test/unit/modules/sfc/sfc-parser.spec.js b/test/unit/modules/sfc/sfc-parser.spec.js
index 4437d516adb..6747b9167e9 100644
--- a/test/unit/modules/sfc/sfc-parser.spec.js
+++ b/test/unit/modules/sfc/sfc-parser.spec.js
@@ -78,6 +78,15 @@ describe('Single File Component parser', () => {
expect(res.template.content.trim()).toBe(`div\n h1(v-if='1 < 2') hello`)
})
+ it('should handle component contains "<" only', () => {
+ const res = parseComponent(`
+
+ <
+
+ `)
+ expect(res.template.content.trim()).toBe(`<`)
+ })
+
it('should handle custom blocks without parsing them', () => {
const res = parseComponent(`