Search code examples
vue.jsvue-resourcevue-router

Attribute "id" is ignored on component


I persistently getting this warning on my vuejs app, dint know where and why:

build.js:9371 [Vue warn]: Attribute "id" is ignored on component <div> because the component is a fragment instance

I am using vue-router, with index.html:

<body>
        <div id="app"></div>
</body>

Solution

  • Just to add to what @Roy J has said. Look through your components. Make sure that all your components have one wrapping dom element around them, like a single parent. The best thing to always do is wrap all elements in your components in one parent div.

    Something like this:

    <div>
      <div>Some content</div>
      <div> some more content </div>
    </div>
    

    That way, Vue know how to mount your component on the parent app. If your component is fragmented, you'll get the error you are talking about. Vue sometimes doesn't tell you which component exactly so you'll have to skim through all your components.