connected-react-router: Problems upgrading to 6.4.0 with React Router 5.0.0

Hi,

I’m getting an issue when I upgrade connected-react-router to 6.4.0 and react-router to 5.0.0. The error is below. I downgraded react-router to 4.3.1, and the error went away. (FWIW, I got the identical error with react-router 5 and connected-react-router 6.3.2)

I’ve spent some time stripping away elements of my app to see if this problem could be coming from somewhere else, and I feel reasonably confident that this issue is due to connected-react-router (but am perfectly willing to admit that this is due to some other library incompatibility).

Anybody else experiencing this issue? Any advice for how I might be able to truly nail down where this is coming from?

Error: You are loading the CommonJS build of React Router on a page that is already running the ES modules build, so things won't work right.

./node_modules/react-router/cjs/react-router.js
node_modules/react-router/cjs/react-router.js:757
__webpack_require__
/Users/bmueller/Sites/learn-frontend/webpack/bootstrap:786
  783 | };
  784 | 
  785 | // Execute the module function
> 786 | modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId));
      | ^  787 | 
  788 | // Flag the module as loaded
  789 | module.l = true;
View compiled
fn
/Users/bmueller/Sites/learn-frontend/webpack/bootstrap:149
  146 | 		);
  147 | 		hotCurrentParents = [];
  148 | 	}
> 149 | 	return __webpack_require__(request);
      | ^  150 | };
  151 | var ObjectFactory = function ObjectFactory(name) {
  152 | 	return {

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 4
  • Comments: 20

Most upvoted comments

OMG!

I just did a search of my code, and it turns out I had two places that used the import Redirect from 'react-router/Redirect' format. And that’s what was breaking my code. As soon as I switched those few places to import { Redirect } from 'react-router-dom' everything worked. What made this hard (obviously) is that the error itself gave no indication of what the source of the problem was. Sigh.

Thanks for everybody’s help! I give this ticket eight facepalms.

🤦‍♂ 🤦‍♂ 🤦‍♂ 🤦‍♂ 🤦‍♂ 🤦‍♂ 🤦‍♂ 🤦‍♂