4.0.0
I got this error:
ReferenceError: location is not defined
at ServerRouter.render (/Users/este/dev/este/node_modules/react-router/ServerRouter.js:58:19)
So I checked transpiled code:
}, {
key: 'render',
value: function render() {
var _props = this.props;
var context = _props.context;
var rest = _objectWithoutProperties(_props, ['context']);
var redirect = function redirect(location) {
context.setRedirect(location);
};
return _react2.default.createElement(_StaticRouter2.default, _extends({
action: 'POP',
location: location,
onReplace: redirect,
onPush: redirect
}, rest));
}
}]);
Note location is retrieved from global state. Node.js does not have it.
This is temp fix
global.location = {};
That's pretty wacky. Your fix isn't correct, as the location you need to be referencing comes from props. I believe it's the arrow function and the scoping is interacting oddly with the object destructuring. I wouldnt be surprised if renaming the local variable to loc would fix it.
Same here, compiling the library directly seems to work fine.
Somehow, babel misses the location variable deconstruction.
For those who are looking for a quick dirty fix (ServerRouter.js):
var location = _props.location; // Add this line after "var context = _props.context;"
var rest = _objectWithoutProperties(_props, ['context', 'location']); // Add missing 'location' to the array
I've locally packed and installed it with no problems.
Seems like it's just a bad transpile job, could someone republish with proper transpilation?
Thanks.
Sounds like a Babel bug?
@mjackson It's not. Just no new 4.0.0 build on npm since this was committed https://github.com/ReactTraining/react-router/commit/9eae41003ac6dc8ec1df862657f60c85a6104626
So any guess on when can we expect the next v4 npm build? :)
Running into this issue too:

v4.0.3 please! :-D
@iammerrick We haven't released 4.0.0 yet, so why would we do 4.0.3? 馃槈
4.0.0-alpha.3 is out: https://github.com/ReactTraining/react-router/releases/tag/v4.0.0-alpha.3
Most helpful comment
v4.0.3 please! :-D