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

135
Views
React Webpack set up chunk optimisation

I was getting my head around optimizing the ReactJS + Wepback application from the performance perspective and came across some useful advice on reducing the JS code in the end bundle. My goal is to, perhaps adjust chunks so that the maximum limit was about 100kb or close to that (if it's generally possible). I did find some tips on Stackoverflow indeed, tho those answers still get me into the huge final bundle size.

Is anyone aware of some resources I can look up directly on improving the vendors and custom code load, or could you please assist in improving the optimisation code?

optimization: {
        splitChunks: {
            chunks: 'async',
            minSize: 20000,
            minRemainingSize: 0,
            minChunks: 3,
            maxAsyncRequests: 30,
            maxInitialRequests: 30,
            enforceSizeThreshold: 50000,
            cacheGroups: {
                vendor: {
                    test: /[\\/]node_modules[\\/]/,
                    name(module) {
                        const packageName = module.context
                            .match(/[\\/]node_modules[\\/](.*?)([\\/]|$)/)[1];

                        return `npm.${packageName.replace('@', '')}`;
                    }
                },
                styles: {
                    name: 'styles',
                    test: /\.css$/,
                    chunks: 'all',
                    enforce: true
                },
                react: {
                    test: /[\\/]node_modules[\\/](react)[\\/]/,
                    name: 'react',
                    chunks: 'all'
                },
                react_dom: {
                    test: /[\\/]node_modules[\\/](react-dom)[\\/]/,
                    name: 'react-dom',
                    chunks: 'all'
                },
                bootstrap: {
                    test: /[\\/]node_modules[\\/](bootstrap)[\\/]/,
                    name: 'bootstrap',
                    chunks: 'all'
                },
                default: {
                    minChunks: 2,
                    priority: -20,
                    reuseExistingChunk: true
                }
            }
        }
    },
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!