//@flow
import React from 'react'
import { Route, IndexRoute } from 'react-router'
import App from './App'

if (process.env.NODE_ENV === 'development' || typeof require.ensure === 'undefined') require.ensure = (undefined, fc) => fc(require)

export default () => ( // eslint-disable-line
  <Route component={App}>
    <Route path="/">
      <IndexRoute
        getComponent={
          (location, callback) => {
            require.ensure([], (require) => {
              callback(null, require('./Posts').default)
            })
          }
        }
      />
      <Route path="addPost"
        getComponent={
          (location, callback) => {
            require.ensure([], (require) => {
              callback(null, require('./AddPost').default)
            })
          }
        }
      />
    </Route>
  </Route>
)

//@flow
import React from 'react'
import { Route, IndexRoute } from 'react-router'
import App from './App'
import Posts from './Posts'
import AddPost from './AddPost'

export default () => ( // eslint-disable-line
  <Route component={App}>
    <Route path="/">
      <IndexRoute component={Posts}/>
      <Route path="addPost" component={AddPost}/>
    </Route>
  </Route>
)

Revert "Disable code-split in development mode and for server side"
Revert "Disable code-split in development mode and for server side"

This reverts commit 90d307f6cf9792882dc4beabc2cd1d007ae26dc6.
