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

Remove HTML comments from production build #1452

Closed
MartinMalinda opened this issue Jan 9, 2021 · 5 comments
Closed

Remove HTML comments from production build #1452

MartinMalinda opened this issue Jan 9, 2021 · 5 comments

Comments

@MartinMalinda
Copy link

MartinMalinda commented Jan 9, 2021

It seems like Vite 1.0 removed HTML comments from the build and the default behavior changed to preserve the comments by default.

Is there a way to set it back to previous behavior? I have mostly notes to myself and other todo-like notes that I'd wish not to be included in the production build:)). I can imagine the build being tiny bit smaller too.

Maybe I can set this to false somewhere in the config?

html5_comments?: boolean

@MartinMalinda
Copy link
Author

MartinMalinda commented Jan 9, 2021

I am trying

  build: {
    terserOptions: {
      parse: {
        html5_comments: false,
      }
    }
  }

But that's probably not what I'm looking for

@anncwb
Copy link
Contributor

anncwb commented Jan 9, 2021

Maybe you can try this simple plugin https://github.com/vbenjs/vite-plugin-html

@MartinMalinda
Copy link
Author

@anncwb that would probably remove HTML comments from the index.html file, but not from component templates, right? Those get compiled into JS.

@anncwb
Copy link
Contributor

anncwb commented Jan 9, 2021

@MartinMalinda Sorry, I got it wrong. This plugin may not suit your needs

@yyx990803
Copy link
Member

You are referring to comments in Vue templates, right?

@github-actions github-actions bot locked and limited conversation to collaborators Jul 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants