title: Code Splitting in create-react-app using react-router v3
body: <p>i am using create-react-app boilerplate for my react app and react-router 3.0.0 version for routing. </p>
  
  <p>I wanted to load component when required i.e basically code splitting. </p>
  
  <p>I am stuck as i don't know how to do code splitting, as i have one HOC with check for User Roles, if user don't have role for a specific route, than i redirect the user to some 'unauthorised' route. </p>
  
  <p>I also have onEnter function which needs to be called before loading any component, which will check if user token is expired or not, if token is expired i am redirecting the user to login page.</p>
  
  <p>so if someone can help me with code splitting in this scenario.</p>
  
  <p>Below is my Route.js file </p>
  
  <pre><code>      &lt;Route path="/" component={App}&gt;
          &lt;IndexRoute onEnter={this.handleLoginRedirect} component={Login} /&gt;
          &lt;Route path="/" component={Layout} onEnter={this.handleRouteEnter} onChange={this.handleRouteChange}&gt;
            &lt;Route path="admin" component={Authorization(Admin, Constant.AdminAuthorizeRoles, '/unauthorised')}&gt;
              &lt;Route path=":mode/:id" component={Admin}&gt;
                &lt;Route exact path=":subMode" component={Admin}/&gt;
              &lt;/Route&gt;
            &lt;/Route&gt;
            &lt;Route path="admin-summary" component={Authorization(AdminOrderSummary, Constant.AdminAuthorizeRoles, '/unauthorised')}/&gt;
            &lt;Route path="user-profile" component={Authorization(Profile, Constant.userProfileAuthorizeRole, '/unauthorised')}/&gt;
            &lt;Route path="new-user" component={Authorization(NewUser, Constant.createNewUserProfileAuthorizeRole, '/unauthorised')}/&gt;
            &lt;Route path="/unauthorised" component={UnAuthorisation}/&gt;
          &lt;/Route&gt;
          &lt;Route path="/logout" component={Logout}/&gt;
        &lt;/Route&gt;
  </code></pre>