Skip to content
This repository was archived by the owner on Jan 5, 2018. It is now read-only.
/ react-setup Public archive

Testing to see how to optimize React for production via Webpack

License

Notifications You must be signed in to change notification settings

timarney/react-setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#Update This information is still relevant but, just use -> Create React App (get back to coding) it handles all of this for you. https://github.com/facebookincubator/create-react-app.

#TL;DR

Do at least this

new webpack.DefinePlugin({
      'process.env': {
        'NODE_ENV': '"production"'
      }
    })

That's a 77 KB win -> because by default, React is in development mode.

Facebook also recommends UglifyJS to completely remove the extra code present in development mode.

https://twitter.com/timarney/status/715614327911395328

#Note Check the Webpack 2 version here https://github.com/timarney/react-setup/tree/webpack2

#What is this? I started this as an experiment to see how big React is for a production build via Webpack (without gzip etc...)

React and React Dom are split out into a vendors.js file (standalone).

Note this isn't a React Starter boilerplate. It's an experiment to test Webpack settings.

#Tips / Ideas? Feel free to send a pull request or add to the dicussion using Issues i.e -> #1

#Production Output

+-- dist
|   +-- bundle.js (495 bytes)
|   +-- index.html (219 bytes)
|   +-- vendors.js (141 kB) 👍

#Build npm run build (output to production dir)

#What about GZIP sizes? Checkout http://minime.stephan-brumme.com/react/15.2.1 (40.9 kB)

About

Testing to see how to optimize React for production via Webpack

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •