Failed to compile the react-router. This happend after installing path-to-regexp
./node_modules/react-router/esm/react-router.js
Attempted import error: 'path-to-regexp' does not contain a default export (imported as 'pathToRegexp').
This error occurred during the build time and cannot be dismissed.
For me, this occurred as my path-to-regex had been updated to newer version.
I solved this by simply reverting back to the old version of path-to-regex.To do that simply run this:
npm i [email protected] --save
Instead of downgrading to an old version, just change the way you import: from:
import pathToRegexp from 'path-to-regexp';
to
import { pathToRegexp } from 'path-to-regexp';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With