Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vue2.4 set comments true, don't work #6177

Closed
Cydmi opened this issue Jul 21, 2017 · 5 comments
Closed

vue2.4 set comments true, don't work #6177

Cydmi opened this issue Jul 21, 2017 · 5 comments

Comments

@Cydmi
Copy link

Cydmi commented Jul 21, 2017

Version

2.4.1

Reproduction link

https://codepen.io/anon/pen/dREmrV

Steps to reproduce

<template>
  <!--hello-->  
  <div class="hello">
    <h1>{{ msg }}</h1>
  </div>
</template>

<script>
export default {
  comments: true,
  data () {
    return {
      msg: 'hello'
    }
  }
}
</script>

vue-cli
comments:true
The comment is gone

What is expected?

see link

What is actually happening?

use vue-cli
The comment is gone

@yyx990803
Copy link
Member

The comment needs to be inside the root element to be preserved.

@Cydmi
Copy link
Author

Cydmi commented Jul 21, 2017

<template>
  <div class="hello">
    <!--hello-->  
    <h1>{{ msg }}</h1>
  </div>
</template>

Thank you,no effect. @yyx990803

@yyx990803
Copy link
Member

Ah, we forgot to mention in the docs: the comments option only works when using the full build with in-browser compilation. It does not work in single file components.

@Kingwl
Copy link
Member

Kingwl commented Jul 21, 2017

vuejs/vue-loader#897

@magedmakled
Copy link

I have a comments in my index.html for a noscripttag before <div id="app"></div>, the comment shows fine on localhost but not on prod, any suggestion?

I've tried comments: true, in main.js with no luck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants