Search code examples
reactjsreduxredux-toolkit

ReferenceError at at importing anything from redux


I'm new at react and i start to work with redux But just at start when i tried to import configureStore from @reduxjs/toolkit i got a ReferenceError for exports not defined!! I searched for it but can't find any solution. think it must be something about my other dependency versions since i'm reading a 2019 course and not all my dependencies are up to date. but i can't figure it out on my own. here are my dependencies:

"dependencies": {
    "@babel/preset-react": "^7.18.6",
    "@reduxjs/toolkit": "^1.9.0",
    "babel-cli": "6.24.1",
    "babel-core": "6.25.0",
    "babel-loader": "7.1.0",
    "babel-plugin-transform-class-properties": "6.24.1",
    "babel-preset-env": "1.5.2",
    "babel-preset-react": "6.24.1",
    "css-loader": "6.7.1",
    "live-server": "^1.2.2",
    "normalize.css": "8.0.1",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-modal": "3.16.1",
    "react-router-dom": "6.4.3",
    "redux": "^4.2.0",
    "regenerator-runtime": "^0.13.10",
    "sass": "1.55.0",
    "sass-loader": "13.1.0",
    "style-loader": "^3.3.1",
    "validator": "8.0.0",
    "webpack": "5.74.0",
    "webpack-dev-server": "4.11.1"
  },
import { configureStore } from '@reduxjs/toolkit';

Solution

  • I had to update my babel-loader, and added these dependencies:

    "@babel/cli": "7.19.3",
    "@babel/core": "7.20.2",
    "@babel/preset-env": "^7.20.2",
    "@babel/preset-react": "^7.18.6"