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

126
Vistas
Webpack 5 does not inject react-code on div in index.html

I'm building a project with react and webpack 5. When building, everything runs without errors, but no components are inserted into the parent div in the main index.html

my file webpack.config

module.exports = (env = {}) => {
    return {
        entry: ['./src/index.js'],
        output: {
            clean: true,
            publicPath: '/',
            path: path.resolve(__dirname, 'build'),
            filename: `bundle-${Number(new Date())}.js`,
        },
        module: {
            rules: [
                {
                    test: /\.jsx?$/,
                    exclude: /node_modules/,
                    use: {
                        loader: 'babel-loader',
                        options: {
                            cacheDirectory: true,
                        },
                    },
                },
            ],
        },
        devServer: {
            hot: true,
            open: true,
            historyApiFallback: true,
            client: {
                overlay: true,
            },
        },
        plugins: [
            new HtmlWebpackPlugin({
                inject: true,
                scriptLoading: 'blocking',
                template: 'public/index.html',
                favicon: 'public/favicon.ico',
            }),
        ],
    }
}

my file package.json

{
  "name": "test",
  "license": "ISC",
  "scripts": {
    "start": "webpack-dev-server --mode=development",
  },
  }
}

Why can this be happening and how can I fix it?

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