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

117
Views
Webpack with React JS App taking too long on hot reload

I have a large react app with material ui and many components. It has 2 webpack config files. One is called webpack.base.config.js and other is webpack.prod.config.js. My script in package.json when I run npm start is webpack-dev-server --mode development --config config/webpack.base.config.js --open --hot --history-api-fallback --env.PLATFORM=local --env.VERSION=stag

To be exact it takes 36 seconds on my 11th Gen Core i5 to hot reload only with eslint code commented out. Also is it a possibility to remove webpack and use normal react-scripts? Complete file is this

const path = require('path');
const webpack = require('webpack');
const merge = require('webpack-merge');

const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const Dotenv = require('dotenv-webpack');

module.exports = env => {
  const { PLATFORM } = env;
  return merge([
    {
      entry: ['@babel/polyfill', path.resolve(__dirname, '../src')],
      module: {
        rules: [
          {
            test: /\.(js|jsx)$/,
            exclude: [/node_modules/, /test\.(js|jsx)$/],
            use: {
              loader: 'babel-loader',
            },
          },
          {
            test: /\.(woff(2)?|ttf|eot|otf|jpe?g|png|gif|svg)$/i,
            loader: 'file-loader',
            options: {
              outputPath: 'images',
              name: '[name].[ext]',
            },
          },
          // {
          //   enforce: 'pre',
          //   test: /\.(js|jsx|mjs)$/,
          //   exclude: /node_modules/,
          //   use: [
          //     {
          //       loader: require.resolve('eslint-loader'),
          //       options: {
          //         eslintPath: require.resolve('eslint'),
          //         emitWarning: true,
          //       },
          //     },
          //   ],
          // },
          {
            test: /\.(scss|css)$/,
            use: [
              PLATFORM === 'production' ? MiniCssExtractPlugin.loader : 'style-loader',
              'css-loader',
              'sass-loader',
            ],
          },
        ],
      },
      plugins: [
        new Dotenv({
          path: './.env',
          systemvars: true,
        }),
        new HtmlWebpackPlugin({
          template: './src/index.html',
          fileName: './index.html',
          hash: true,
        }),
        new webpack.DefinePlugin({
          'process.env.VERSION': JSON.stringify(env.VERSION),
          'process.env.PLATFORM': JSON.stringify(env.PLATFORM),
        }),
        new CopyWebpackPlugin([{ from: './src/assets/favicon.png' }]),
      ],
      output: {
        filename: '[name].bundle.js',
        path: path.resolve(__dirname, '..', 'dist'),
        publicPath: '/',
      },
    },
  ]);
};
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!