I'm using localStorage
and sessionStorage on a StencilProject.
When I'm running npm run dev --prod
it's ok.
When I'm running npm run build
this is KO.
Even with this error, my app works great on Chrome but not in Firefox.
The error is:
localStorage is not defined
So I changed my call from localStorage.getItem
to window.localStorage
, so now I have the following error:
Cannot read property 'getItem' of undefined
Any idea on how using localStorage
in prod compatibility?