Unable to render HTML comments in Components. #12902
-
I have a Vue componentthat renders an article as HTML, a 3rd party requires that we indicate where in the page headlines and article content are with html comments, which show up locally on my dev server, but once deployed to our production server they dissapear, even though the code is actually builtin dev mode because vite.config has mode: 'development',
gard coded into it. The build log confirms it;s in dev mode:
vite v6.0.6 building for development...
I also have app.config.compilerOptions.comments = true
in app.js.
Yet the comments are not visible anywhere.
Is there another setting I'm missing that might be causing the comments not to be rendered?
Beta Was this translation helpful? Give feedback.
All reactions
Did you configure @vitejs/plugin-vue? Try this in your Vite config:
vue({ template: { compilerOptions: { comments: true, }, }, })
Replies: 2 comments 2 replies
-
Did you configure @vitejs/plugin-vue? Try this in your Vite config:
vue({ template: { compilerOptions: { comments: true, }, }, })
Beta Was this translation helpful? Give feedback.
All reactions
-
That's cracked it!
Any idea why setting the config in code like I had didn't work? I'm guessing I had the object structure wrong maybe?
Beta Was this translation helpful? Give feedback.
All reactions
-
app.config.compilerOptions
applies to runtime compiler options, but in a Vite project, .vue
files are compiled by @vitejs/plugin-vue
. That’s why configuring it in your code didn’t work.
Beta Was this translation helpful? Give feedback.