React Router 4 and Dynamic Imports?


Hey guys,
I’m just wondering if you’ve already implemented Dynamic Imports with React Router? For the moment, I’m trying something like this:

<Route path="login" getComponent={(loc,cb) => { import("./pages/login/login").then(({Login}) => cb(Login))}} onEnter={this.onEnter}/>

But I only get a red error in the console with the function name of “Login” (without any details about the error, I only see the function):

function Login(props) {                                                                                            // 61
        (0, _classCallCheck3.default)(this, Login); 



I’m looking at something simular right now. Did you manage to get it to work? :slight_smile: