Good day! I’ve got errors Uncaught TypeError: setting getter-only property "todo" and Uncaught TypeError: lib is undefined. My assumption is that those errors appear when I created a new module for local storage API.
I moved specific functions of local storage to that module.
When the whole code stored in the global scope, app functions fine without issues. The syntax for named export/import is correct.
export let todo = JSON.parse(localStorage.getItem("todo-list"));
export function setLocalStorage() {
localStorage.setItem("todo-list", JSON.stringify(todo));
}
How it’s imported:
import { todo, setLocalStorage } from "./modules/storageModule";
I tried it, it still doesn’t work for me. But if I use build config without server, it works fine. I think, I will just build manually every time when I need to refresh the page