title: Configuring app's basename in react-router
body: <p>I'm struggling a bit with react-router 2.x configuration, specifically app basename.</p>
  
  <p>I've an application which may have different base root throughout its lifecycle. For instance:</p>
  
  <ul>
  <li><code>/</code> in development</li>
  <li><code>/users</code> in production</li>
  <li><code>/account</code> in production after migration</li>
  </ul>
  
  <p>The basename comes into play in several places:</p>
  
  <ul>
  <li>static asset compilation in Webpack</li>
  <li>react-router main configuration</li>
  <li>specifying redirect routes in redux actions</li>
  <li>providing something like <code>redirectUrl</code> to API calls</li>
  </ul>
  
  <p>My current solution is to have an ENV variable and make it available both to Webpack and to the app itself by injecting <code>window.defs</code> via an Express server, but I still end up having things like <code>${defs.APP_BASENAME}/signin</code> in way too many places throughout the app.</p>
  
  <p>How can I abstract the app base, or at least tuck it away in a single location? I should be able to specify the base route in Router's config, and then simply use relative routes somehow, right? Or am I missing something?</p>