Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

392
Vistas
minify also html with vite.js: how to make vite bundle on npm run build delete comments or tabs in html?

I have a javascript project that uses the vite bundle. https://vitejs.dev/

CSS, and JS get minified successfully on https://vercel.com production site

but HTML have still the comments <!-- comments -->

(I am using javascript vanilla, no react)

I've seen the GitHub issue tab, but do not understand anything (and the thing they technically solve aren't listed on the DOCS webpage)

  • here: https://github.com/vitejs/vite/pull/793 (i've saw something like apply config, but docs don't show how to use it, or flush)

basically, I want that dev environment have comments that show the details of something,
but on production, the comments don't get pushed.


here I tried to do a simplified example (not a real example) to show the problem:

enter image description here

why production have the <!-- <button> --> while js with all comments get deleted. (and also how to delete spaces, and tabs in HTML for smaller gzip files index.html


I want to be like this:

enter image description here

(here a tool that minify https://www.willpeavy.com/tools/minifier/)


if you tried with vite and don't work,
I will tell you a hint:

from what I know vite use rollup under the hood, so maybe there is a config in rollup that can work well for vite, do you find some docs about it?

I use vite to not care about config or have less config possible, but maybe is this the case to use configs.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda