### Version 2.5.22 ### Reproduction link [https://codesandbox.io/s/52k2p9po54](https://codesandbox.io/s/52k2p9po54) ### Steps to reproduce Go to the codesandbox. Try to parse the given template with comments on. ```vue <template> <!-- here is a nice component template --> <button class="buttonComponent">click</button> </template> ``` ### What is expected? The comment AST node should be attached to the root object. ### What is actually happening? ```path node_modules/vue-template-compiler/build.js:2469:21) TypeError: Cannot read property 'children' of undefined (currentParent is undefined) ``` --- I am going to try my hand at a PR. Wish me luck ;) <!-- generated by vue-issues. DO NOT REMOVE -->