Skip to content

Auto chunking and dynamic loading of routes with React Router and Webpack 2

Notifications You must be signed in to change notification settings

ModusCreateOrg/react-dynamic-route-loading-es6

 
 

Repository files navigation

PRPL example with Webpack 2 and React

Demonstrating PRPL in 7 steps - from a bundled app to code splitting and chunk preloading.

You can also see the preso that accompanies this source code sample.

Stack

Steps

Browser setup

I recommend you use Google Chrome with the following setup to benchmark the differences:

  • Clean browser, no plugins (private mode is fine)
  • Disable caching
  • Bandwidth throttling to Regular 3G
  • CPU throttling to 5x slowdown

All of these are in Network and Timeline tabs of Chrome DevTools.

System Requirements

Before installing the dependencies, make sure your system has the correct Node and Npm versions.

  • Node 6+
  • Npm 3+

Setup

$ npm install

Running in Dev mode

$ npm start

Running in Prod mode

$ npm run prod

Need help?

Reach out, we'd love to see how we can help your project.