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

260
Vistas
Should Webpack HTML templates have hash in file name?

I'm new to bundling node.js apps with Webpack. I understand that hashes in filenames help with updating browser caches with new content.

Let's say I have the following HtmlWebpackPlugin config and express route:

// webpack.front-end.config.js
plugins: [
  new HtmlWebpackPlugin({ minify, template: path.resolve('./src/index.html'), filename: 'index.[hash].html', chunks: ['home'] })
]

// server.js
app.get('/', (req, res) => {
  res.sendFile('index.abc1234.html');
});

Then I change my content in index.html and it generates index.def3456.html.

How do I write my express route or change my webpack config so that I don't have to change the filename in the res.sendFile() call each time I change index.html content? Should I even have the hash in the index.html's filename? I'm aware I can put meta tags in index.html to avoid browser caching, but that seems like it would slow down performance.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

There's no point in using the hash here. The client is not requesting the html file directly so it doesn't really matter what you name the file. All the client sees is the / endpoint.

about 4 years ago · Juan Pablo Isaza Denunciar
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