Importing persistState is undefined
JulianSalomon opened this issue · 2 comments
When I try to import redux-localstorage
as follows
import persistState from 'redux-localstorage';
I get this error TypeError: redux_localstorage_1.default is not a function
.
Then I tried const persistState = require('redux-localstorage');
and it worked.
The problem is that require
is incompatible with Angular
ERROR in src/app/app.module.ts(11,22): error TS2304: Cannot find name 'require'.
Should I import require
in the project?, There is another way to import it with import ... from ...
?
Thanks in advance.
This workaround worked for me but compiler complained if you have @types/redux-localstorage
installed.
import * as persistState from 'redux-localstorage';
That solution worked for me too.
Thanks @vincic!