MacFJA / svelte-persistent-store

A Svelte store that keep its value through pages and reloads
MIT License
244 stars 15 forks source link

localStorage is not a function when using sveltekit #17

Open isaacfink opened 2 years ago

isaacfink commented 2 years ago

I get the following error when using sveltekit

__vite_ssr_import_0__.localStorage is not a function

this is my store code

export const cart = persist(writable({packages:[]}), localStorage(), 'cart')
michaelcuneo commented 2 years ago

localStorage() has been changed to createLocalStorage()

MacFJA commented 2 years ago

I rename the function that give the storage between version 1.3.0 and 2.0.0. They were given the false impression that the same instance of the storage was given every time. With the new name it's clear that the function create a new storage instance