Closed JulianSalomon closed 6 years ago
When I try to import redux-localstorage as follows
redux-localstorage
import persistState from 'redux-localstorage';
I get this error TypeError: redux_localstorage_1.default is not a function.
TypeError: redux_localstorage_1.default is not a function
Then I tried const persistState = require('redux-localstorage'); and it worked.
const persistState = require('redux-localstorage');
The problem is that require is incompatible with Angular
require
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 ...?
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';
@types/redux-localstorage
import * as persistState from 'redux-localstorage';
That solution worked for me too.
Thanks @vincic!
When I try to import
redux-localstorage
as followsimport 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 AngularERROR 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 withimport ... from ...
?Thanks in advance.