I have update webpack (5.93.0) and react (18) and redux (5) to last version but now I have a lot of errors similar this:
Can’t import the named export ‘applyMiddleware’.’apply’ (imported as ‘applyMiddleware’) from default-exporting module (only default export is available)
and this is the relative class:
import React, { Component } from 'react';
import { createStore, applyMiddleware } from 'redux';
import thunk from 'redux-thunk';
import createSagaMiddleware from 'redux-saga';
import { createLogger } from 'redux-logger';
import Provider from 'react-redux';
import { ConnectedRouter, routerMiddleware } from 'react-router-redux';
import { writeConfigurationSaga } from './sagas/writeConfigurationSaga';
import App from './App';
import reducers from './reducers';
const history = require("history").createHashHistory();
// create saga middleware
const sagaMiddleware = createSagaMiddleware();
const middlewares = [routerMiddleware(history), thunk, sagaMiddleware];
if (process.env.NODE_ENV !== 'production') {
const logger = createLogger({ collapsed: true });
middlewares.push(logger);
}
const store = createStore(reducers, applyMiddleware(...middlewares));
document.querySelector('#closeSwOnClick').onclick = function () {
window.close();
};
// run sagas
sagaMiddleware.run(writeConfigurationSaga);
class SwTest extends Component {
componentDidMount() {
this.props.history.push('/sw-test/home');
}
render() {
return <Provider store={store} history={history}>
<ConnectedRouter history={history} store={store}>
<App />
</ConnectedRouter>
</Provider>;
}
}
export default SwTest;
I not able to undestand if the problem is on update of react/redux or if webpack is not configured correctly. Thanks in advanced