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

233
Visualizações
Webpack doesn't load HTML

I get 404 not found error when loading the HTML page with webpack. These are my configurations.

Webpack.config.js:

const path = require('path');

module.exports= {
    devServer: {
        // contentBase
        static : {
          directory : path.join(__dirname, 'public/')
        },
        port: 3000,
        // publicPath
        devMiddleware:{
           publicPath: 'https://localhost:3000/dist/',
        },
        // hotOnly
        hot: 'only',
      },
};

The other file configurations are on the screenshot. The webpack server runs correctly, but when I try to load the page I get this error. Please tell me where I am wrong.

Screenshot of the other files. webpackProblem

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Do you have your index.html in the right place in your /public folder?

From the webpack docs:

To load your bundled files, you will need to create an index.html file in the build folder from which static files are served (--content-base option).

Or try put this in webpack.config.js:

 devServer: {
  historyApiFallback: true,
}

Or sometimes you could need to point out your historyApiFallback index.html file like this:

 devServer: {
        historyApiFallback:{
            index:'build/index.html'
        },
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