Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse errors in imported module 'react-router-dom' errors #61

Open
tommi-lew-tw opened this issue Feb 16, 2022 · 0 comments
Open

Parse errors in imported module 'react-router-dom' errors #61

tommi-lew-tw opened this issue Feb 16, 2022 · 0 comments

Comments

@tommi-lew-tw
Copy link

tommi-lew-tw commented Feb 16, 2022

Read this first

As of time of writing this issue, V7 of this course is releasing soon. You may want to refer to the V7 course for a solution.

Context

This issue occured at the React Capabilities --> Class Properties section of the course.

Issue

I was running into these Parse errors in imported module 'react-router-dom' errors right after adding and configuring the new Babel dependencies.

Parse errors in imported module 'react-router-dom': No Babel config file detected for /path/to/project/node_modules/react-router-dom/esm/react-router-dom.js. Either disable config file checking with requireConfigFile: false, or configure Babel so that it can find the config files.

This is highlighted for any files which imports react-router-dom.

Solution

This Github issue (babel/babel#11975) helped. It also explained the root cause. I explicitly specify the .babelrc config file in .eslintrc.json and the error is now gone.

"parserOptions": {
    "babelOptions": {
      "configFile": "./.babelrc"
    }
  }

Note that babelOptions has to be under parserOptions.

If above solution does not work

If the above solution doesn't help doesn't help, there is another solution as a Pull Request in this repo - #41 . Do take a look too.

Hope it helps!

-- @tommi-lew

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant