Vishesh Duggar bio photo

Vishesh Duggar

5x founder. Co-founder & CTO Product @vamstar. 15+ years building and advising startups of all sizes. If you're building something cool, I'd love to hear about it.

Looking for advice on product, strategy or engineering?

Book Appointment

Subscribe to my mailing list


Vamstar LinkedIn Twitter Github

So I tried upgrading CRA for an existing app. I wanted to use the latest React Fast Refresh to hot reload react while making changes. Everything worked fine locally on the dev machine but the build failed on CircleCI while minifying.

It turned out to be a resourcing issue and Terser config had to be overridden without ejecting CRA of course.

Publishing the config I used borrowed from here.


const { override } = require('customize-cra');
const { addReactRefresh } = require('customize-cra-react-refresh');
const TerserPlugin = require('terser-webpack-plugin');

const overrideTerser = options => config => {

  config.optimization = {
    minimize: true,
    minimizer: [
      new TerserPlugin({
        terserOptions: {
          parse: {
            ecma: 8,
          },
          compress: {
            ecma: 5,
            warnings: false,
            comparisons: false,
            inline: 2,
            drop_console: true,
          },
          mangle: {
            safari10: true,
          },
          output: {
            ecma: 5,
            comments: false,
            ascii_only: true,
          },
        },
        parallel: 2,
        cache: true,
        sourceMap: true,
        extractComments: true,
      }),
    ],
  };
  return config;
};

/* config-overrides.js */
module.exports = override(addReactRefresh({ disableRefreshCheck: true }), overrideTerser());

15+ Years strategising and delivering growth, engineering, customer value and more. I have served as a CTO to multiple organizations, including Vamstar, AtruHelp, Billaway, SuperSehat, and more.

If you're a founder or CEO eager to move faster and seek tailored strategies for your unique challenges, don't navigate this journey alone. Reach out to me. Together, we can dissect, refine, and optimize your enterprise's trajectory to withstand the tests of time and innovation. Let's make your vision not just a goal, but an impending reality.

I have limited open hours. Book Appointment