You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 13, 2020. It is now read-only.
It seems like it is a problem with pwa-helpers, but I am going to fill the issue here, because maybe I am just misunderstanding the configuration.
Reproduce:
clone the pwa-starter kit
npm i
npm i --save redux-logger
open src/store.js,
add lines:
import logger from 'redux-logger'
const middleware = [logger, thunk]
change line: compose(lazyReducerEnhancer(combineReducers), applyMiddleware(logger))
into compose(lazyReducerEnhancer(combineReducers), applyMiddleware(...middleware))
and then npm start.
Error message:
Uncaught TypeError: middleware is not a function
at applyMiddleware.js:59
at Array.map (<anonymous>)
at applyMiddleware.js:58
at lazy-reducer-enhancer.js:43
at <anonymous>:1:28482
at createStore (createStore.js:64)
at store.js:32
at f ((index):112)
at (index):112
at h ((index):112)
I fixed it myself. It has nothing to do with the redux version. The problem is importing the dist file. You have to import source-files for some middlewares, like so:
import logger from 'redux-logger/src';
I also have an angular project with redux and this project doesnt have this problem. So maybe it is worth mentioning somewhere or changing the configuration.
Thanks for investigating @evayde . Our setup/tooling requires the use of ES modules - since redux-logger doesn't have module in package.json, we must rely on the the source which is written with ES modules.
It seems like it is a problem with pwa-helpers, but I am going to fill the issue here, because maybe I am just misunderstanding the configuration.
Reproduce:
open src/store.js,
add lines:
change line:
compose(lazyReducerEnhancer(combineReducers), applyMiddleware(logger))
into
compose(lazyReducerEnhancer(combineReducers), applyMiddleware(...middleware))
and then npm start.
Error message:
Environment:
on an Ubuntu 18.04 LTS.
node version: 10.6.0
npm version: 6.1.0
Am I doing it wrong? If so, please add another example to the documentation on how to add multiple Middlewares, too.
The text was updated successfully, but these errors were encountered: