Code splitting with Webpack2 and System.import does not work when using react-router-redux

135 views Asked by At

I'm trying to do "code splitting" with Webpack 2 and the System.import syntax, and for some reason react-router-redux gives me trouble.

My route looks like so

<Provider store={Store}>
    <Router history={history}>
        <Route 
            path="some-page" 
            getComponent={(location, cb) => {
                System.import('./some-module.jsx')
                    .then((module) => cb(null, module.default))
                    .catch((error) => console.error('Dynamic page loading failed', error));
      }}/>
</Router>

When using 'react-router-redux'

import { routerActions } from 'react-router-redux';
routerActions.push('/some-page');

The url changes but nothing else happens.

Now if I use the react router browserHistory API - it works!

import { browserHistory } from 'react-router/es6';
browserHistory.push('/some-page');

Any ideas on how to solve this with react-router-redux? Thanks in advance.

0

There are 0 answers