Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

123
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!