profile
viewpoint

Ask questionsReceiving ESM Error but not using ESM

<!-- BUG TEMPLATE -->

Version

5.0.0

Steps to reproduce

  1. Install React Router and Dom
  2. Add line import {HashRouter, Switch, Route} from 'react-router-dom';
  3. Build app
  4. See error

Expected Behavior

In my console I see this error

Please use `import { Router } from "react-router"` instead of `import Router from "react-router/es/undefined"`. Support for the latter will be removed in the next major release

Actual Behavior

I am not importing anything with the es/undefined syntax so this error should not appear.

ReactTraining/react-router

Answer questions StringEpsilon

Can you create a minimum reproduction repository? This really shouldn't happen, unless a step in your build process changes the imports or another dependency of yours uses the old import style.

At the very least, we need more information about your build process. Do you use babel with any fancy plugins? Typescript? Rollup, Parcel or Webpack? (Edit: This is most likely an issue with your setup)

useful!

Related questions

Cannot read property &#39;location&#39; of undefined at useLocation hot 9
Route is not exported in react-router-dom hot 6
Error: Invariant failed: You should not use <Switch> outside a <Router> hot 3
Replace componentWillMount by UNSAFE_componentWillMount for v3 hot 3
Use new forwardRef API in withRouter HOC hot 2
useParams returns empty object when used outside of Route hot 2
Failed prop type: Invalid prop 'component' supplied to 'Route': the prop is not a valid React component hot 2
useParams and other new hooks are not exported in react-router-dom & react-router hot 2
react-router-dom v5 does not work with electron in production hot 2
Prompt in React 16 "Warning: A history supports only one prompt at a time" hot 1
Fix <Route children> hot 1
Route is not exported in react-router-dom hot 1
bug: react router dom 4.3.1 pulling react-router 4.4.0 changes after latest publish hot 1
[React.memo] Warning: Failed prop type: Invalid prop `component` of type `object` supplied to `Route`, expected `function` hot 1
useParams and other new hooks are not exported in react-router-dom & react-router hot 1
source:https://uonfu.com/
Github User Rank List