Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

261
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda