React-starter-kit: Build gets pretty big

Created on 2 Nov 2015  路  8Comments  路  Source: kriasoft/react-starter-kit

Hi,

When I build the react-starter-kit without any adjustments, the client app.js is over 280KB. I think this is quite huge, especially when using it in a mobile app. What are your thoughts on this? What can we do to optimise it?

Cheers!

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Most helpful comment

@alotov-agina The production build is a lot smaller.

$ npm run build -- --release

All 8 comments

React with add ons alone is 140Kb

When we serve the JS gzipped, it's getting very acceptable :). But still I think 140KB on top of the 140KB (React+addons) is quite a lot..

Any big eCommerce site on a mobile phone will be a minimum 250kb in .js files. That's not considering extra external scripts and the monolithic CSS files they force you to download. To me, this is a trade off. No one said isomorphic sites were slim, or any site using a framework of any kind.
Anyway, that's my two-cents.

To reduce this file size, you may want to use code splitting, making sure that only the code which is actually is going to be used on the page is loaded at the initial load.

I just downloaded the boilerplate and did an npm run build.
The main.js in build/public is 3.33 MB in file-size. For real? Or am I doing something wrong here?

@alotov-agina The production build is a lot smaller.

$ npm run build -- --release

Note that build includes CSS, you can make it even faster and less with:

  1. code-splitting (https://github.com/webpack/webpack/tree/master/examples/code-splitting)
  2. plugins
    transform-react-remove-prop-types
    transform-react-constant-elements
    transform-react-inline-elements
    (see https://github.com/kriasoft/react-starter-kit/pull/440)
  3. use NODE_ENV=production

Thank you guys!

Was this page helpful?
0 / 5 - 0 ratings