Iam trying to use applyMiddleware from redux but when I edit package.json file
( adding => "type" : "module" ) to use ES6 to import applyMiddleware as following
import { createStore, applyMiddleware } from "redux";,
I have that ERROR
\node_modules\redux\lib\redux.js:671
return middleware(middlewareAPI);
^
TypeError: middleware is not a function
but when I remove ( "type" : "module" ) from package.json file and import applyMiddleware as following
const redux = require("redux");
const createStore = redux.createStore;
const applyMiddleware = redux.applyMiddleware;
it works fine. why applyMiddleware works only with commenJS and how to make it works with type module.