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

fix(compiler-core): comments in the <pre> tag should be removed in production mode #2221

Closed
wants to merge 3 commits into from
Closed

fix(compiler-core): comments in the <pre> tag should be removed in production mode #2221

wants to merge 3 commits into from

Conversation

HcySunYang
Copy link
Member

Fix: #2217

@HcySunYang
Copy link
Member Author

HcySunYang commented Sep 24, 2020

The compiler in production mode:

image

@posva
Copy link
Member

posva commented Sep 24, 2020

Can we add a test that toggles production mode and checks this behavior?

@HcySunYang HcySunYang changed the title fix(compiler-core): the codegen should not append comma to comments in production mode fix(compiler-core): remove the comments in the pre tag Sep 24, 2020
@HcySunYang
Copy link
Member Author

@posva yes I do it later

@HcySunYang HcySunYang changed the title fix(compiler-core): remove the comments in the pre tag fix(compiler-core): comments in the <pre> tag should be removed in production mode Sep 24, 2020
@FrankFang
Copy link

Just ask, why not keep html comments in <pre> ?

@HcySunYang
Copy link
Member Author

By default, comments are not kept in production, but you can achieve this by providing the comments: true option to the compiler

@chenhaihong
Copy link

Just ask, why not keep html comments in <pre> ?

The both ones below work with the same as each other in a pure html doc.
So i think that it may remove the html comments in a production mode.

# code a
<pre>
      <!-- <code class="javascript" v-hljs>const a = 100;</code> -->
      <code class="javascript">const a = 100;</code>
</pre>

# code b
<pre>
      <code class="javascript">const a = 100;</code>
</pre>

But the point is to fix the error of compiler.

@yyx990803
Copy link
Member

See f411924 - I refactored the logic to avoid duplicated code/iterations.

@yyx990803 yyx990803 closed this Oct 5, 2020
@JasperTey
Copy link

JasperTey commented Jan 24, 2021

By default, comments are not kept in production, but you can achieve this by providing the comments: true option to the compiler

Where exactly do I specify this comments: true option? Somewhere within my package.json? Within my webpack config "vue-loader" options? Or somewhere else?

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

Successfully merging this pull request may close these issues.

Error "Cannot read property 'el' of undefined" in production mode
6 participants